Sunday, April 04, 2010 5:07 AM
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.
Sunday, April 04, 2010 7:25 AMModerator
You can select items in a listbox using the below code
wpflist.SelectedItemsAsString = "<Listitems's text>";
- Proposed As Answer by Vishnu [MSFT]Microsoft Employee, Moderator Sunday, April 04, 2010 7:26 AM
Sunday, April 04, 2010 9:17 AM
There is no any property called 'SelectedItemsAsString'.
Sunday, April 04, 2010 10:23 AM
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().
- Proposed As Answer by Gautam Goenka [MSFT]Microsoft Employee Sunday, April 04, 2010 10:23 AM
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.
Monday, April 05, 2010 2:45 PMModeratorListView is again considered as a List in CUIT. And the property "SelectedItemAsString" should suffice your requirement.
Tuesday, April 06, 2010 5:59 AM
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.