I am trying to implement ctrl+shift+mouseover on a button in wpf, mvvm. I am doing something like:
<Button.InputBindings>
<KeyBinding Gesture="Ctrl+Shift" Command="{Binding KeyCommand}"
CommandParameter="{Binding Mode=OneWay, RelativeSource={RelativeSource Self}}"
/>
</Button.InputBindings>
or something like:
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseEnter">
<i:InvokeCommandAction Command="{Binding MouseOverCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
I am unable to get the required behavior as Mouse Gesture does not support "MouseEnter" event. I was trying to implement in a way like:
Step 1.- Through keybinding setting a variable in the viewmodel.
Step 2.- Accessing that variable's value on MouseEnter and do whatever in the command.
Any help is appreciated.
You could implement an attached behaviour that hooks up event handlers to the
MouseEnterandMouseLeftButtonDownevents and check whether the Ctrl and Shift keys are pressed by the time the events are raised, e.g.: