I have a listbox with EventTrigger MouseDoubleClick.
This does not work : EventName="MouseDoubleClick"
This works : EventName="MouseLeftButtonUp"
Here's the View
<ListBox x:Name="MyListBox" />
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<command:EventToCommand Command="{Binding UserSelectionCommand}"
CommandParameter="{Binding SelectedItem, ElementName=MyListBox}"
/>
</i:EventTrigger>
</i:Interaction.Triggers>
In ViewModel
public RelayCommand<string> UserSelectionCommand
{get; private set;}
UserSelectionCommand = new RelayCommand<string>(ShowSelectedItem);
private void ShowSelectedItem(string selectedData)
{ .. }
The closing ListBox should be after the Interaction.Triggers, not before.
<ListBox>
<Interaction.Triggers>
..
<Interaction.Triggers>
</ListBox>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.