Roest
Topic Author
Posts: 28
Joined: 15 Jan 2020, 15:30

Button command on right click

17 May 2020, 17:18

Is there a way to execute a command on right clicking a button?

Something like
<Button.InputBindings>
    <MouseBinding Gesture="RightClick" 
        Command="{Binding command }" 
        CommandParameter="{Binding param}"/>
</Button.InputBindings>
doesn't work because MouseBinding doesn't seem to exist in Noesis. So what's the recommended way?
 
User avatar
sfernandez
Site Admin
Posts: 1928
Joined: 22 Dec 2011, 19:20

Re: Button command on right click

22 May 2020, 16:16

You can use an interactivity trigger reacting to MouseRightButtonDown:
<Button>
  <i:Interaction.Triggers>
    <i:EventTrigger EventName="MouseRightButtonDown">
      <i:InvokeCommandAction Command="{Binding command}" CommandParameter="{Binding param}"/>
    </i:EventTrigger>
  </i:Interaction.Triggers>
</Button>

Who is online

Users browsing this forum: No registered users and 1 guest