wpf-notifyicon
wpf-notifyicon copied to clipboard
RightClickCommand missing
I have a requirement to show the application window on any interaction with the tasktray icon.
LeftClickCommand
works great, but there is nothing for right-click.
I tried handling MouseRightButtonUp
but it doesn't seem to work. I think the event doesn't originate from the notify icon.
<tb:TaskbarIcon x:Name="MyNotifyIcon"
NoLeftClickDelay="True"
IconSource="{Binding Path=DynamicAppIcon}"
DoubleClickCommand="{Binding ShowWindowCommand}"
LeftClickCommand="{Binding ShowWindowCommand}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseRightButtonUp">
<i:InvokeCommandAction Command="{Binding ShowWindowCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</tb:TaskbarIcon>
Would it be possible to create a RightClickCommand
?
Handling the MouseRightButtonUp event normally in the view .cs file, the event still does not get fired.
This is the error message when attempting to use the command binding above:
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=ShowWindowCommand; DataItem='ViewModel' (HashCode=6956456); target element is 'InvokeCommandAction' (HashCode=51797270); target property is 'Command' (type 'ICommand')
I used to use TrayRightMouseDown
for right click command.