Page 1 of 1

[1.3 b3]ComboBox select wrong item

Posted: 03 Nov 2016, 11:18
by decai
Hi,

We use version 1.3 beta3 and run Tutorial05 with ComboBox.xaml in the smaple.

1. We modify the first ComboBox added 13 items more. Then there will a scrollbar, we use the mouse wheel scroll to the last item "Item 17" and click left mouse to select it,
2016-11-03_180140.png
but "Item 8" will be selected
2016-11-03_180146.png
.
If we click the scrollbar scroll to the last item it will select right time.

2. In the first picture the ComboBox selector is larger than the main view, when the mouse position is outside the main view but inside the selector VisualTreeHelper::HitTest will return nullptr.


Thanks.

Re: [1.3 b3]ComboBox select wrong item

Posted: 04 Nov 2016, 14:18
by sfernandez
1. I found the bug, we were selecting the wrong item on mouse down when ComboBox had no focus. We will solve it for next release.

2. I don't understand, what do you mean for "larger than the main view"? Which visual are you passing as root in the VisualTreeHelper::HitTest call?

Re: [1.3 b3]ComboBox select wrong item

Posted: 04 Nov 2016, 16:24
by decai
Hi,

There is a new picture, we hope it will make the problem more clear.
2016-11-03_180140.png
2016-11-03_180140.png (94.83 KiB) Viewed 3973 times
As describe above, is that we should call VisualTreeHelper::HitTest using the ComboBox as root view? If so, the ComboBox is a child view of the main grid view, is that mean every time we do HitTest we should call VisualTreeHelper::HitTest for all child views of the parent view?

Thanks.

Re: [1.3 b3]ComboBox select wrong item

Posted: 04 Nov 2016, 17:08
by sfernandez
Every View has a Root visual that allows Popups and ToolTips to show over the rest of elements.
ComboBox drop down is added as a Popup to the View, so it is not a visual child of the ComboBox.

If you want to test if mouse is over any element of the UI (including Popups and ToolTips) you should do it this way:
VisualTreeHelper::HitTest(VisualTreeHelper::GetRoot(visual))
Where visual is any visual in the UI tree, for example the ComboBox.

Re: [1.3 b3]ComboBox select wrong item

Posted: 05 Nov 2016, 14:26
by decai
Got it. Thanks

Re: [1.3 b3]ComboBox select wrong item

Posted: 11 Nov 2016, 21:47
by jsantos
Thanks for your detailed feedback!