ivan_b
Topic Author
Posts: 87
Joined: 22 Jul 2015, 12:57

Button in ListBox strange behaviour

15 Jul 2016, 09:40

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?
Last edited by ivan_b on 18 Jul 2016, 09:33, edited 1 time in total.
 
User avatar
ai_enabled
Posts: 221
Joined: 18 Jul 2013, 05:28
Contact:

Re: Button in ListBox strange behaiour

15 Jul 2016, 09:59

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!
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
 
ivan_b
Topic Author
Posts: 87
Joined: 22 Jul 2015, 12:57

Re: Button in ListBox strange behaiour

15 Jul 2016, 10:07

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
 
User avatar
sfernandez
Site Admin
Posts: 1912
Joined: 22 Dec 2011, 19:20

Re: Button in ListBox strange behaviour

18 Jul 2016, 15:58

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?
 
ivan_b
Topic Author
Posts: 87
Joined: 22 Jul 2015, 12:57

Re: Button in ListBox strange behaviour

18 Jul 2016, 19:06

If the ScrollViewer property PanningMode is set to "None" then it works but if it is set to "VerticalOnly" then the problem occours.
 
User avatar
jsantos
Site Admin
Posts: 2904
Joined: 20 Jan 2012, 17:18
Contact:

Re: Button in ListBox strange behaviour

20 Jul 2016, 15:19

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!
 
User avatar
sfernandez
Site Admin
Posts: 1912
Joined: 22 Dec 2011, 19:20

Re: Button in ListBox strange behaviour

22 Jul 2016, 14:16

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.

Who is online

Users browsing this forum: No registered users and 1 guest