Locked Select item from listbox

  • Sunday, April 04, 2010 5:07 AM
     
     

    Hello,

    I want to select item from list box, I dont want to hard core through index of an item.

    List items doesn't have an AutomationId or NameProperty.List items have text property set to it.

    Thanx in advance.

     

     

All Replies

  • Sunday, April 04, 2010 7:25 AM
    Moderator
     
     Proposed

    You can select items in a listbox using the below code

    wpflist.SelectedItemsAsString = "<Listitems's text>";

  • Sunday, April 04, 2010 9:17 AM
     
     

    Hi Vishnu,

    There is no any property called 'SelectedItemsAsString'.

     

     

     

  • Sunday, April 04, 2010 10:23 AM
     
     Proposed

    There is one on List (and not on ListItem).

    Also check http://blogs.msdn.com/gautamg/archive/2010/02/19/useful-set-of-utility-functions-for-coded-ui-test.aspx for some good set of utility functions including ListItem.Select().

    Thanks.


    http://blogs.msdn.com/gautamg
  • Monday, April 05, 2010 11:49 AM
     
     

    I think I framed question wrongly.

    I want to select item from listview.

    Sorry for the inconvience caused.

     

    Thanks.

  • Monday, April 05, 2010 2:45 PM
    Moderator
     
     
    ListView is again considered as a List in CUIT. And the property "SelectedItemAsString" should suffice your requirement.
  • Tuesday, April 06, 2010 5:59 AM
     
     

    Hi Vishnu,

    Thanx for ur reply.

    There is no any property called 'SelectedItemsAsString' on List.

    My application is WPF application.I have given AutomationID to the list view and list items are getting generated run-time. Now I am accessing list view through AutomationID.List items contain TextBlock whose Text property is set to the actual text of list item.So now I want to select this list item through this Text property.