In WPF: how to disable the animation when the button after be pressed?
This thing above solves the problem, but it changes whole template, is there any more elegant solution, for example something like this:
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="StoryBoard" Value="Disable" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="StoryBoard" Value="Disable" />
</Trigger>
</Style.Triggers>
you can also use a handler for PreviewMouseLeftButtonDown instead ButtonClick
function will be the same and command e.Handled = true; ensures that the animation does not start
private void button_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
//some your code
e.Handled = true;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With