wpf-notifyicon icon indicating copy to clipboard operation
wpf-notifyicon copied to clipboard

RightClickCommand missing

Open ssolmer opened this issue 4 years ago • 2 comments

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 ?

ssolmer avatar Aug 19 '20 18:08 ssolmer

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')

ssolmer avatar Aug 19 '20 19:08 ssolmer

I used to use TrayRightMouseDown for right click command.

SparrowBrain avatar Nov 22 '21 06:11 SparrowBrain