Hi guys,

New here.

My question is, I wanted to take a keyboard input when a storyboard is running and with that input, stops that storyboard and jump to another one.

I am "fixing" someone elses code and the way these storyboards are implemented are as follows.
There are states (in C#) such as STATE_1, STATE_2, etc...

When the app starts, when a person press PgDn, a MoveForward function is called which has a switch/case statement.
case STATE_1 {do something}

In that STATE_1, a storyboard is initialized and started.

For example:
Storyboard s = (Storyboard)Window.FindResource("StopWhenPressPgDn");
StopWhenPressPgDn.Begin(this, true);
So, if I press PgDn again, it calls the MoveForward function agains and jumps to the next storyboard without stopping the current one.

So, I tried something like this from STATE_1:

KeyDown += new System.Windows.Input.KeyEventHandler(Windscreen_KeyDown);
Then it creates this function for me:

private void Windscreen_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
// TODO: Add event handler implementation here.
if(e.Key == System.Windows.Input.Key.Next)
// Kill the current storyboard and load the next one

But I am not sure how to pass the current storyboard to the event or object and stop it. The only way I know how to stop storyboard is via StoryboardName.Stop(this) and that Storyboard is initialized inside the MoveForward function which the Windscreen_KeyDown does not have access to.

Thanks bunch!