I have a ListView which shows the products in a shopping cart. The datatemplate defines an increment and a decrement amount button for each product.
If the user wants to tap one of these buttons, there's a chance that they tap next to the button, so the ItemClick event will be triggered. I want to disable ItemClick in the area of the button. I had an idea to get the position where the ItemClick event occurred, and determine if it's in the disabled area which I defined.
Is it possible? Any other idea?
There's a simple way to do this. Use an element as the "disabled area" around these increment/decrement buttons. In the ItemClick handler, say if (e.OriginalSource == **the element which is the disabled area**) return;.
This works, because the ItemClickedEventArgs is a RoutedEventArgs which always contains the element where it originated from. See https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.itemclickeventargs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With