Search code examples
c#xamllistviewuwp

Prevent double clicking on column section from triggering doubletapped event


So I have a ListView with a DoubleTapped event attached to it in .XAML. The problem is that I don't want it to register when I'm double clicking on a column section. Only when double clicking on any other section of the control. Can I somehow specify it in the .XAML, or maybe detect it in the code in the event handler that the click was on the columns and therefore do no action?

I tried checking DataContext type of source in EventArgs, but it's the same whether you click on columns or on some other space.

I expected to be able to detect that the click occurred on the columns section and therefore take no action in the event handler.

I didn't manage to detect that the click occurred on the columns section why


Solution

  • To fix a problem, I just needed to add the same DoubleTapped event to the ListView.Header element and then in the event handler method set e.handled to true. That thing fixed the issue.