This is a migrated thread and some comments may be shown as answers.

How to get the combobox items in silverlight

3 Answers 109 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kiran
Top achievements
Rank 2
Kiran asked on 28 Jul 2010, 09:46 AM
Hi,

I am using WebAii. 2010.1 version for silverlight 3 automation.

I have to get all the ComboBoxItmes from a combobox. But i am getting empty list.

 

 

 

ComboBox cmbBox = app.Find.ByType<ComboBox>();

 

 

IList<TextBlock> blocks = cmbBox.Find.AllByType<TextBlock>();

 

 

IList<ComboBoxItem> items= cmbBox.Items;

 

 

IList<ComboBoxItem> cmbItems = cmbBox.Find.AllByType<ComboBoxItem>();

 

 

IList<FrameworkElement> cmbFrameworkItems = cmbBox.Find.AllByType("ComboBoxItem");

 

 


Thanks
Kiran

3 Answers, 1 is accepted

Sort by
0
Accepted
Konstantin Petkov
Telerik team
answered on 28 Jul 2010, 09:51 AM
Hi Kiran,

Is this combo's drop down open when you attempt to get its items? Some components do not generate their items visually until you open/expand them.

All the best,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kiran
Top achievements
Rank 2
answered on 28 Jul 2010, 10:19 AM
Hi Petkov ,

No its not getting opened at that time.
I tried opening the combobox first using click and its working now.
Thanks for your help.

Could you please tell me which are the other controls which behaves like this.

Thanks
Kiran

0
Konstantin Petkov
Telerik team
answered on 28 Jul 2010, 11:05 AM
Hi Kiran,

I'm glad that helped.

Be aware of that when you automate also navigation controls like the tree view. As far as I remember RadTreeView (and probably other RadControls) are behaving like this. It doesn't generate the node sub items until you expand that node. The sub items are just generated on-demand.

Developers usually implement this for performance optimization reasons. They don't want the users to load that control on the page for a long time generating sub controls that may not be in use at all.

Sincerely yours,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Kiran
Top achievements
Rank 2
Answers by
Konstantin Petkov
Telerik team
Kiran
Top achievements
Rank 2
Share this question
or