How to: Disable (and re-enable) a ToggleButton Event Trigger (Storyboard - Double Animation)

video.baba

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.

Raviraj Palvankar

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to enable/disable trigger in procedure?

From Dev

How to enable and disable onclick event

From Dev

ToggleButton IsChecked Trigger with Storyboard Targetname Issue

From Dev

How to disable and then enable onclick event on <div> with javascript

From Dev

Looping Storyboard Animation Without Trigger

From Dev

Conditional Disable / Re-Enable jQuery click event

From Dev

Animation Trigger (Storyboard + Trigger) in C#

From Dev

Animation Trigger (Storyboard + Trigger) in C#

From Dev

Re enable click event

From Dev

how to enable and disable double click mouse options in kde

From Dev

How to enable and disable the button in a checked event of checkbox in jQuery?

From Dev

How can i enable/disable a button in a backgroundworker DoWork event?

From Dev

How to enable and disable css transition in one js-event?

From Dev

How to Disable / Re-enable Javascript on window resize?

From Dev

How to disable and re enable the click functionality of a div using Jquery

From Dev

How to disable then re-enable a watchdog interrupt for Arduino?

From Dev

How to add custom binding on ToggleButton animation

From Dev

How to disable click event in slideshow until animation is finished and then bind it again?

From Dev

Is there any way to trigger storyboard on event in View?

From Dev

How to prevent a double execution of a single-click event when actually trying to trigger a double click event?

From Dev

Reverse storyboard's animation on click event

From Dev

Disable an event and again enable the event back in jQuery

From Dev

How to disable default PowerPoint event functionality of double click and right click?

From Dev

How to trigger storyboard every time

From Dev

Enable & Disable trigger in db2

From Dev

WPF: How to write efficiently a storyboard for multiple controls with the same animation and different event handler for `completed`?

From Dev

Disable scroll, animation, then enable scroll again

From Dev

Disable scroll, animation, then enable scroll again

From Dev

How to enable / disable a Preference?

Related Related

  1. 1

    How to enable/disable trigger in procedure?

  2. 2

    How to enable and disable onclick event

  3. 3

    ToggleButton IsChecked Trigger with Storyboard Targetname Issue

  4. 4

    How to disable and then enable onclick event on <div> with javascript

  5. 5

    Looping Storyboard Animation Without Trigger

  6. 6

    Conditional Disable / Re-Enable jQuery click event

  7. 7

    Animation Trigger (Storyboard + Trigger) in C#

  8. 8

    Animation Trigger (Storyboard + Trigger) in C#

  9. 9

    Re enable click event

  10. 10

    how to enable and disable double click mouse options in kde

  11. 11

    How to enable and disable the button in a checked event of checkbox in jQuery?

  12. 12

    How can i enable/disable a button in a backgroundworker DoWork event?

  13. 13

    How to enable and disable css transition in one js-event?

  14. 14

    How to Disable / Re-enable Javascript on window resize?

  15. 15

    How to disable and re enable the click functionality of a div using Jquery

  16. 16

    How to disable then re-enable a watchdog interrupt for Arduino?

  17. 17

    How to add custom binding on ToggleButton animation

  18. 18

    How to disable click event in slideshow until animation is finished and then bind it again?

  19. 19

    Is there any way to trigger storyboard on event in View?

  20. 20

    How to prevent a double execution of a single-click event when actually trying to trigger a double click event?

  21. 21

    Reverse storyboard's animation on click event

  22. 22

    Disable an event and again enable the event back in jQuery

  23. 23

    How to disable default PowerPoint event functionality of double click and right click?

  24. 24

    How to trigger storyboard every time

  25. 25

    Enable & Disable trigger in db2

  26. 26

    WPF: How to write efficiently a storyboard for multiple controls with the same animation and different event handler for `completed`?

  27. 27

    Disable scroll, animation, then enable scroll again

  28. 28

    Disable scroll, animation, then enable scroll again

  29. 29

    How to enable / disable a Preference?

HotTag

Archive