ComboBox.Select on combo boxes with scrollable lists

Nov 17, 2008 at 2:26 PM
Edited Nov 17, 2008 at 2:26 PM
Hi,

The Combobox.Select method doesnt work if the expanded combobox list is scrollable and the item you want to select isn't currently visible given the scrollbars current position.

I think this could be resolved by implementing Select using the control pattern and not as a mouse click based on the screen position of the item in the list.

Cheers,

James.
Nov 17, 2008 at 4:52 PM
Well, I think it would be best if the select would scroll the list until the item is visible and then click the item. This way the behavior would be of a user as it should be. I don't know if it's a easy way to implement it though.

José Tavares
Coordinator
Nov 19, 2008 at 6:15 PM
This is exactly how it is implemeted. There are some unit tests which do this.
Can you send me a failing example or something?
Dec 3, 2008 at 3:03 PM
I'm having a similar problem.  If my combo box (which is scrollable) is opened in a downward direction the value is selected with no problems, but if the combo box opens in an upward direction (due to space in the UI; my app is an XBAP app) a value will not be selected.

My code used for selection:

 

var searchCriteria = SearchCriteria.ByAutomationId(autoID);

 

comboBoxAttribute = window.Get<

WPFComboBox>(searchCriteria);

 

 

comboBoxAttribute.Click();
comboBoxAttribute.Select(num);



The error I receive is:

 

[failure]Error invoking WPFComboBox.Select

Bricks.BricksException

Message: Error invoking WPFComboBox.Select

Source: Bricks.RuntimeFramework

StackTrace:

at Bricks.RuntimeFramework.ReflectedObject.Invoke(MethodInfo methodInfo, Object[] arguments)

at Bricks.DynamicProxy.DynamicProxyInterceptors.Process(IInvocation invocation, InterceptContext interceptedContext)

at Core.Interceptors.CoreInterceptor.Intercept(IInvocation invocation)

at Castle.DynamicProxy.AbstractInvocation.Proceed()

at WPFComboBoxProxy670fe852d9164266a7804a855bbf76b8.Select(Int32 index)

 

Inner Exception

Core.UIItems.UIActionException

Message: Could not make the WPFListItem with AutomationId=<empty> and Name=itemName visible, after waiting for 5000 ms

Source: Core

StackTrace:

at Core.UIItems.Scrolling.ScreenItem.<MakeVisible>b__2()

at Bricks.Core.Clock.RunWhile(DoAndNoReturn do, Condition condition, Expired expired)

at Core.UIItems.Scrolling.ScreenItem.MakeVisible(VerticalSpan verticalSpan)

at Core.UIItems.ListBoxItems.ListControl.ActionPerforming(UIItem uiItem)

at Core.UIItems.ListBoxItems.WPFComboBox.ActionPerforming(UIItem uiItem)

at Core.UIItems.ListBoxItems.ListItem.Select()

at Core.UIItems.ListBoxItems.ListItems.Select(Int32 index)

at Core.UIItems.ListBoxItems.ListControl.Select(Int32 index)

Coordinator
Dec 8, 2008 at 5:25 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.