Page 1 of 1
Button in ListBox strange behaviour
Posted: 15 Jul 2016, 09:40
by ivan_b
On mobile devices when I have a Button inside a ListBoxItem and I want to press the button the ListBoxItem that contains the button gets selected.
How can I avoid that?
Re: Button in ListBox strange behaiour
Posted: 15 Jul 2016, 09:59
by ai_enabled
Hello!
This is strange. The event should be handled by the button and doesn't propagate to parent controls.
Can you reproduce the same issue on desktop, by using the same XAML styles/templates?
Regards!
Re: Button in ListBox strange behaiour
Posted: 15 Jul 2016, 10:07
by ivan_b
On desktop this issue does not happen.
Tere is also a problem when i use buttons as items inside an ItemsControl, in this case the IsPressed property is never true, my guess that the cause for this probelm is the same.
It probably has something to do with how ListBoxItem works when using touch events.
For now a workaround for this would be fine but I can't find any.
Thanks
Re: Button in ListBox strange behaviour
Posted: 18 Jul 2016, 15:58
by sfernandez
Hi,
I tried both a ListBox and an ItemsControl and I was unable to reproduce that behavior.
In my tests only the Button is clicked and ListBoxItem is never selected unless item is touched outside the button. And if an ItemsControl is used the Button changes its visual state to pressed when a finger touches the Button.
Could you please create a ticket in our
bugtracker and attach a simple sample where you can reproduce the problem?
Re: Button in ListBox strange behaviour
Posted: 18 Jul 2016, 19:06
by ivan_b
If the ScrollViewer property PanningMode is set to "None" then it works but if it is set to "VerticalOnly" then the problem occours.
Re: Button in ListBox strange behaviour
Posted: 20 Jul 2016, 15:19
by jsantos
Sorry for the delay Ivan. Sergio is out of the office till Friday. He will continue investigating the issue as soon as he is back.
Thanks!
Re: Button in ListBox strange behaviour
Posted: 22 Jul 2016, 14:16
by sfernandez
Hi Ivan,
I have no problems neither using PanningMode=VerticalOnly, there must be something different in my tests.
Could you please post here (or better in the bugtracker) what you are trying to do?
Thanks.