ComboBoxItems not found when using ControlTemplate

3 posts, 0 answers
  1. donovan
    donovan avatar
    15 posts
    Member since:
    Jun 2011

    Posted 15 Apr 2014 Link to this post


    I'm having an issue where the ComboBoxItems are not being recognized in Silverlight. I am using a standard ComboBox with the attached style.

    Other Combo Boxes seem to work find but this one uses a Control template with some additional features. When I view it in SilverlightSpy I can see the items fine (see attached).

    My code
                var combo = _silverlightApp.Find.ByName<ComboBox>("cbFacilityTypes");
                //Items = null

    I have tired 
                combo.IsDropDownOpen = true;            
               //looping through children the ScrollContentPresenter is always empty.
               //in the screen I can see it expanding the right combo but it just cant find any of the child controls but I can see them in SilverlightSpy

    Any help much appreciated

  2. donovan
    donovan avatar
    15 posts
    Member since:
    Jun 2011

    Posted 16 Apr 2014 in reply to donovan Link to this post

    Apologies seems this was posted twice.

    I have a work around :) 

    var cb = _silverlightApp.Find.ByName<ComboBox>("cbFacilityTypes");
    cb.IsDropDownOpen = true;
    var cb = _silverlightApp.Find.ByName<ComboBox>("cbFacilityTypes");
    //now has items

  3. Konstantin Petkov
    Konstantin Petkov avatar
    1911 posts

    Posted 17 Apr 2014 Link to this post


    No problem about the duplicate!

    As to the code, it looks just fine. The RefreshVisualTrees() method takes care of updating all the popups within the scope of the element (MS ComboBox in this case) so that the test code can proceed with the up to date visual tree.

    Konstantin Petkov
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top