Edit: To make it short: as AFigmentOfMyImagination pointed out in his answer, there exists no IsPressedChanged
event. However, here is the original question:
I have a button and I want a command to be executed both when the button is pressed and when it is released. The standard command binding of buttons can only call the command either when the button is pressed OR released so I figured I might achieve what I want using an interaction trigger on the IsPressedChanged
event like so:
<Button xmlns:i="http://schemas.microsoft.com/xaml/behaviors">
<i:Interaction.Triggers>
<i:EventTrigger EventName="IsPressedChanged">
<i:InvokeCommandAction Command="{Binding Path=SomeCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
But this does not work. It does however work when I use other events like the MouseEnter
event.
Now my question is, why is that? What is the difference between the IsPressedChanged
event and other events? It seems to me as if there is some conceptual difference and I'd like to know what that is (and maybe why there needs to be a difference).
Edit: I have found a way to have the command beeing executed on every IsPressed
change. That solution is used in this question.