MouseDoubleClick is not working in Noesis
Hello there, could I get some help on troubleshooting why MouseDoubleClick is not working, here are some context:
I created an inventory grid with slots in it, the slot (item) has a few interactions:
Hover, Click - Different visual states, and they are handled via Visual State Manger
Drag to move the item - it's a custom function we created to allow players to drag item to a different spot in the inventory. But this function listens to MouseLeftButtonDown / MouseLeftButtonUp
We need to create a different way to equip an item from the inventory grid, we thought double clicking is the most natural way to do that.
This is where it stops working, If the event is MouseDoubleClick, it wont do anything, but if I do MouseEnter, the command will work, so I know the command and the binding are correct, it's just the double click is not being listened.
I created an inventory grid with slots in it, the slot (item) has a few interactions:
Hover, Click - Different visual states, and they are handled via Visual State Manger
Drag to move the item - it's a custom function we created to allow players to drag item to a different spot in the inventory. But this function listens to MouseLeftButtonDown / MouseLeftButtonUp
We need to create a different way to equip an item from the inventory grid, we thought double clicking is the most natural way to do that.
Code: Select all
<b:EventTrigger EventName="MouseDoubleClick">
<b:InvokeCommandAction
Command="{Binding DataContext.EquipItem, ElementName=InventoryRoot}"
CommandParameter="{Binding}">
</b:InvokeCommandAction>
</b:EventTrigger>
-
-
sfernandez
Site Admin
- Posts: 3272
- Joined:
Re: MouseDoubleClick is not working in Noesis
Hello, the DoubleClick event is defined by the Control class, so you'll have to set the EventTrigger in a Control-like element, for example:
Could you try that?
Code: Select all
<ContentControl>
<b:Interaction.Triggers>
<b:EventTrigger EventName="MouseDoubleClick">
<b:InvokeCommandAction .../>
</b:EventTrigger>
</b:Interaction.Triggers>
<Grid>...</Grid>
</ContentControl>
Re: MouseDoubleClick is not working in Noesis
Thanks for looking into this. I added a ContentControl to the listboxitem template, and wrapped everything within it. Unfortunately, MouseDoubleClick is still not firing, but MouseEnter works with this setup as well.
Re: MouseDoubleClick is not working in Noesis
Is your integration properly injecting Double Click events to the View?
Could you please verify this with the person in charge of the integration?
Code: Select all
/// Notifies that a mouse button was double clicked. Origin is in the upper-left corner.
/// When a double click happens the following sequence of events are expected:
/// - MouseButtonDown (first click)
/// - MouseButtonUp
/// - MouseDoubleClick (second click)
/// - MouseButtonUp
/// See https://docs.microsoft.com/en-us/windows/win32/learnwin32/mouse-clicks#double-clicks
/// Returns true if event was handled
virtual bool MouseDoubleClick(int x, int y, MouseButton button) = 0;