Having trouble using new EventTrigger with InvokeCommandAction (Managed Noesis 2.2.3)
Posted: 11 Jul 2019, 19:26
I'm trying to connect the PreviewMouseDown event from my View to a DelegateCommand in my ViewModel. My View's DataContext is properly set to my ViewModel and binding is working fine.
View.xaml
ViewModel
I stole the DelegateCommand from your latest samples and ICommand from windows.
I'm not seeing the command executed. It just fails silently.
Is there something I'm missing here?
View.xaml
Code: Select all
<UserControl x:Class="Modules.FileManager.FileManagerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Modules.FileManager"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
Initialized="OnInitialized">
<ListView
SelectionChanged="OnSelectionChanged"
SelectionMode="Single"
Style="{StaticResource FileManagerListViewStyle}"
ItemContainerStyle="{StaticResource FileManagerListViewItemStyle}"
ItemsSource="{Binding FileManagerCollectionView.FileManagerCollectionView}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="PreviewMouseDown">
<i:InvokeCommandAction Command="{Binding ListViewDownCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<ListView.ItemTemplate>
...
ViewModel
Code: Select all
...
public FileManagerViewModel(IFileManagerCollectionView collectionView)
{
FileManagerCollectionView = collectionView;
ListViewDownCommand = new DelegateCommand(OnListViewDownCommand);
}
private void OnListViewDownCommand(object obj)
{
throw new NotImplementedException();
}
public ICommand ListViewDownCommand { get; private set; }
...
I'm not seeing the command executed. It just fails silently.
Is there something I'm missing here?