This project is read-only.

Is there a way to get the values from a WPFComboBox

Nov 5, 2008 at 11:58 PM
I have some code that selects a value from a WPFComboBox, but after that I want to retrieve the name of the value I select so that I can use it further down in my tests.

Here is the code I use to select the value:


var searchCriteria = SearchCriteria.ByAutomationId("RequestTypeComboBox");
var RequestType = Environment.window.Get<WPFComboBox>(searchCriteria);

Using UISpy the attribute I want to get is the "Name".  Does anybody know how to do this?

I've already tried using:

But those aren't returning the value I'm looking for.

Thanks in advance.


Nov 6, 2008 at 12:20 AM
Have you tried RequestType.SelectedItem or RequestType.SelectedItemText ?
Nov 6, 2008 at 8:44 PM
Thanks for the response.  I did try that but it gives me the object name, not the name of the value that was selected.
Nov 9, 2008 at 11:47 AM
This is a known issue in white because of UIA bug.
This happens when ComboBox items in the actual code do not have implementation of ToString method which provides the Text displayed.
Nov 9, 2008 at 11:48 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.