How to get the combobox items in silverlight

4 posts, 1 answers
  1. Kiran
    Kiran avatar
    56 posts
    Member since:
    Dec 2008

    Posted 28 Jul 2010 Link to this post

    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

  2. Answer
    Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 28 Jul 2010 Link to this post

    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
  3. Kiran
    Kiran avatar
    56 posts
    Member since:
    Dec 2008

    Posted 28 Jul 2010 Link to this post

    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

  4. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 28 Jul 2010 Link to this post

    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
Back to Top