I have a WPF ListView that opens a certain window when double clicked on a certain item inside the list view, but I have a problem. When I double click the GridViewColumn, that also opens up a certain window. Is there a way to detect if the sender is a gridviewColumn or a listView item? Thanks
2 Answers
3
votes
I assume you're handling the MouseDoubleClick event of the ListView ? Instead, you should handle that event on the ListViewItem, not the ListView itself. You can do that easily by setting the event handler in the ListView's ItemContainerStyle :
...
<ListView ...>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<EventSetter Event="MouseDoubleClick" Handler="YourHandler" />
</Style>
</ListView.ItemContainerStyle>
</ListView>
...
0
votes