-
- AndreasEnscape
- Posts: 22
- Joined:
InputBindings mouse gestures missing?
Greetings all,
following this Document https://www.noesisengine.com/docs/Gui.C ... orial.html, I want to implement a command reacting to a right click or left double click, as it is common in WPF.
However, while the code in line with the above mentioned example works
anything using a WPF like mouse binding (right click, double click) fails completely, the command method never ever gets called, neither using "MouseAction" nor "Gesture"
Is this functionality implemented at all? If not, how can I realize commands with mouse actions such as the above ones?
I do NOT want a MouseDblBlick="..." solution with dependency objects/properties....
Thanks in advance for assistance,
Andy
EDIT: Important is, that I need to bind to something else than a button, such as a StackPanel....
following this Document https://www.noesisengine.com/docs/Gui.C ... orial.html, I want to implement a command reacting to a right click or left double click, as it is common in WPF.
However, while the code in line with the above mentioned example works
Code: Select all
<ToggleButton Height="120" VerticalAlignment="Center" ...
Command="{Binding Path=MyMouseClickCommand}" CommandParameter="testtext"/>
Code: Select all
<ToggleButton Height="120" VerticalAlignment="Center" >
<ToggleButton.InputBindings>
<MouseBinding MouseAction="RightClick"
Command="{Binding Path=MyMouseRightClickCommand}"
CommandParameter="Bla"/>
</ToggleButton.InputBindings>
</ToggleButton>
I do NOT want a MouseDblBlick="..." solution with dependency objects/properties....
Thanks in advance for assistance,
Andy
EDIT: Important is, that I need to bind to something else than a button, such as a StackPanel....
-
-
sfernandez
Site Admin
- Posts: 2783
- Joined:
Re: InputBindings mouse gestures missing?
Hi,
Mouse input bindings are not implemented yet, only key bindings are available right now. Could you please create a ticket in our bugtracker so we can add them in a future release?
As we found very common the need to connect via XAML a RoutedEvent to a Command we are thinking of including the following attached behavior to NoesisGUI: https://gist.github.com/s-fernandez-v/5 ... ce428808bd.
It would allow doing what you want like this (CommandParameter attached property can be added easily):
You could add that EventToCommand code to your project as a workaround until we correctly implement MouseBindings.
Mouse input bindings are not implemented yet, only key bindings are available right now. Could you please create a ticket in our bugtracker so we can add them in a future release?
As we found very common the need to connect via XAML a RoutedEvent to a Command we are thinking of including the following attached behavior to NoesisGUI: https://gist.github.com/s-fernandez-v/5 ... ce428808bd.
It would allow doing what you want like this (CommandParameter attached property can be added easily):
Code: Select all
<ToggleButton Height="120" VerticalAlignment="Center"
EventToCommand.Event="MouseRightButtonDown"
EventToCommand.Command="{Binding MyMouseRightClickCommand}"
EventToCommand.CommandParameter="Bla">
Re: InputBindings mouse gestures missing?
There is one drawback of this approach, that you can only bind one event inside an element (i.e. you cannot bind MouseDown and MouseUp at the same time).As we found very common the need to connect via XAML a RoutedEvent to a Command we are thinking of including the following attached behavior to NoesisGUI: https://gist.github.com/s-fernandez-v/5 ... ce428808bd.
I prefer the approach using Markup Extension as we previously discussed here: viewtopic.php?f=3&t=1150
-
- AndreasEnscape
- Posts: 22
- Joined:
Re: InputBindings mouse gestures missing?
Imho i would follow the MS approach, having <MouseBinding...> and <KeyBinding...> tags. First of all you can have multiple of them and would thus not end up having the problem nikobarli described, second of all it maintains compatibility....
I will file a bugtracer report and link this discussion.
Regards,
Andy
I will file a bugtracer report and link this discussion.
Regards,
Andy
-
-
sfernandez
Site Admin
- Posts: 2783
- Joined:
Re: InputBindings mouse gestures missing?
MouseBindings will be implemented in Noesis, so this should probably be the best option to connect mouse events to commands.
But the EventToCommand attached properties, or the extension @nikobarli was talking about could still be very interesting when dealing with other events.
I think both approaches are compatible and complementary.
But the EventToCommand attached properties, or the extension @nikobarli was talking about could still be very interesting when dealing with other events.
I think both approaches are compatible and complementary.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 2 guests