simonb
Topic Author
Posts: 24
Joined: 22 May 2021, 16:35

right click on buttons

02 Jun 2022, 18:15

Hi

I'm trying to implement mouse right click functionality for a Button element
it works fine in Blend with:
		<Button.InputBindings>
                    <MouseBinding
                        Command="{Binding RightClickToRemoveItem}"
                        CommandParameter="Item1"
                        Gesture="RightClick" />
                </Button.InputBindings>
But in Unity the bound function in the viewmodel does not get hit if I run it under the debugger

Does NG support the "RightClick" Gesture?
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: right click on buttons

06 Jun 2022, 16:10

MouseBinding is still not implemented in Noesis: #1161. I'm gonna include it for the next release.

In the meantime you can use an interactivity EventTrigger to invoke a command in the same way:
<Button>
  <b:Interaction.Triggers>
    <b:EventTrigger EventName="MouseRightButtonDown">
      <b:InvokeCommandAction Command="{Binding RightClickRemoveItem}" CommandParameter="Item1"/>
    </b:EventTrigger>
  </b:Interaction.Triggers>
</Button>
 
simonb
Topic Author
Posts: 24
Joined: 22 May 2021, 16:35

Re: right click on buttons

13 Jun 2022, 10:52

great thanks for the work around & update

Who is online

Users browsing this forum: Bing [Bot], sfernandez and 5 guests