I have a ToggleButton which, when clicked, slides out so the user can verify/edit the URL (textbox in button) they have copied (clipboard). The ToggleButton is then clicked again, which sets in motion various URL checks and slides back in to its original start position. This works perfectly. (code below).
What I would really like to do a this point is to disable this trigger. I want the button to not 'slide out', because on the next click it will download. So I'm trying to find a way to disable the trigger. When the file has downloaded all OK I'll re-enable the trigger to a state it was initially.
The togglebutton style starts like this (in my Application.xaml:
<Style x:Key="ToggleButtonURL" TargetType="{x:Type ToggleButton}">
It sets various colour/font properties and the triggers of interest:
<Style.Triggers>
<EventTrigger RoutedEvent="Checked">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation From="-554" To="0" Duration="0:0:0.2" Storyboard.TargetProperty="(Canvas.Left)" AutoReverse="False" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="Unchecked">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation From="0" To="-554" Duration="0:0:0.150" Storyboard.TargetProperty="(Canvas.Left)" AutoReverse="False" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
I'm just trying to find a way the enable/disable this trigger from code. Thank you if you can be of any help.
Try setting the e.Handled = true of your event argument only on the condition when you don't want the animation to run. If that is still beating you with the quick in-out movement then use a PreviewEvent instead of a direct event.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments