I have the following visual tree for which I am trying to send a command through the EventToCommand. The visual is as follow :
<Border Background="Gray" Grid.Row="0" Margin="2" VerticalAlignment="Bottom">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown">
<cmd:EventToCommand
Command="{Binding ShowVideosCmd}"
PassEventArgsToCommand="True"
CommandParameter="{Binding Videos}">
</cmd:EventToCommand>
</i:EventTrigger>
</i:Interaction.Triggers>
</Border>
When clicking on the border where the command is attached to I get the following popup error :
"An unhandled exception of type 'System.InvalidCastException' occurred in GalaSoft.MvvmLight.WPF4.dll
Additional information: Unable to cast object of type 'System.Windows.Input.MouseButtonEventArgs' to type 'System.Windows.DependencyObject'. "
My command is then created in a viemModel as follow :
ShowVideosCmd = new RelayCommand<DependencyObject>(
(dpObj) =>
{
messenger.Default.Send<string>("ShowVideos");
},
(dpObj) => true
);
What did I do wrong ?