Hi
I am having issues with UltraUiaComboBox. Simply i want to select item from dropdown and i do this:
Combobox.SelectedItem = "Item"... After this I see that it clicks on dropdown icon and it is moving from top to bottom of dropdown list and at the end if fails.
What is going on ?
i tried with http://msdn.microsoft.com/en-us/library/system.windows.automation.selectionitempattern.select.aspx
solution and it seams that everything is going to be ok but when it tries to do .select() ... Exception happens.
if this is not possible to do, is there any other way to get all items except combobox.items.
I made workaround to select dropdown item but this combobox.items method is taking long time to get all the items.
I am trying to get all items using NativeElements ..
Thanks to good friend Chris :) who pointed me in right direction i made workaround that looks like this:
UltraUiaComboBox uuComboBox = ( UltraUiaComboBox )control;
if ( uuComboBox.SelectedItem == providedValue) break;
AutomationElement containerAutomationElement = uuComboBox.NativeElement as AutomationElement; AutomationElementCollection elements = containerAutomationElement.FindAll( TreeScope.Children, Condition.TrueCondition ); uuComboBox.SetFocus(); Keyboard.SendKeys( "{HOME}" );
for ( int i = 0; i < elements.Count; i++ ) { try { string name = elements[ i ].Current.Name; if ( String.IsNullOrEmpty( name ) || name != providedValue) Keyboard.SendKeys( "{DOWN}" ); else break; } catch { } }
I know that this is not best solution but it is only one that works for me now. If someone finds other solution please reply on this thread.