Any way to attach a command to the PreviewMouseDown event of a ListViewItem?
Posted: 05 Aug 2019, 21:42
I have a <ListView> which I can attach a command to the PreviewMouseDown event, and that works well.
But, because it doesn't provide the EventArgs, I can't see which ListViewItem was clicked.
Is there a way to attach this same event but to the ListViewItem itself? I've tried putting it into the ControlTemplate and the Style but haven't been able to get either working.
I'm not sure how to do this in WPF either, but I've seen some work-around which I don't think can be done in Noesis.
Thanks!
But, because it doesn't provide the EventArgs, I can't see which ListViewItem was clicked.
Is there a way to attach this same event but to the ListViewItem itself? I've tried putting it into the ControlTemplate and the Style but haven't been able to get either working.
Code: Select all
<ListView
SelectionMode="Single"
Style="{StaticResource FileManagerListViewStyle}"
ItemContainerStyle="{StaticResource FileManagerListViewItemStyle}"
ItemsSource="{Binding FileManagerCollectionView.FileManagerCollectionView}">
<i:Interaction.Triggers>
<i:EventTrigger RoutedEvent="PreviewMouseDown">
<i:InvokeCommandAction Command="{Binding ListViewDownCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
...
Thanks!