Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Set SelectedItem in ShapeListBox from outside (Read 1464 times)
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Set SelectedItem in ShapeListBox from outside
Aug 20th, 2010 at 9:31am
Print Post  
Hi.

I use the ShapeListBox to define the Shape of my ShapeNode. I save the name of the shape I selected in the ListBox as a name in my database, and with ShapeConverter.ConvertFromString(string name) I get the shape again when loading the Data. But now I want the SelectedItem in the ShapeListBox to be the one I have selected. this should be set from outside.
So like: listbox.SelectedItem = ...
I tried it with the shape itself and a ShapeNode, but everytime the Property SelectedItem stays NULL.

How can I set the SelectedItem from outside?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Set SelectedItem in ShapeListBox from outside
Reply #1 - Aug 20th, 2010 at 9:51am
Print Post  
It's a hack, but this will select the shape with the specified id:

Code
Select All
ListBox listBox = shapeListBox1;
foreach(ShapeNode node in listBox.Items)
{
	if (node.Shape.Id == id)
	{
		listBox.SelectedItem = node;
		break;
	}
} 

  
Back to top
 
IP Logged
 
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Re: Set SelectedItem in ShapeListBox from outside
Reply #2 - Aug 20th, 2010 at 10:32am
Print Post  
Ah perfect. Thanks
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint