none
Storyboard completed

    Question

  • I seem to be getting in to my storyboard completed event multiple times, can anyone help me with this issue - here is the code I do to start the storyboard:

     

    private void SurfaceWindow_PreviewContactHoldGesture(object sender, ContactEventArgs e)

    {

    currentSB = (Storyboard)FindResource("wipeTransition");

    currentSB.Completed += new EventHandler(sb_Completed);

     

    currentSB.Begin(myUserControl);

    }

     

     

    void sb_Completed(object sender, EventArgs e)

     

     

    Object obj = loadFile(fileName);

     

     

    if (obj != null)

     

    }

     Thanks

     

     

     

     

     

     

    {

     addObjectToUsercontrol(obj);

    {

    Thanks
    Thursday, April 08, 2010 8:03 PM

Answers

  • It looks like you are adding a handler for the storyboard Completed event each time you get a PreviewContactHoldGesture event. If you add multiple event handlers, you'll get multiple events. Try putting these two lines:

    currentSB = (Storyboard)FindResource("wipeTransition");

    currentSB.Completed += new EventHandler(sb_Completed);

    in another place that only gets called once, or at least use a flag to indicate you've already added it once.

    Doug 

    Monday, May 17, 2010 11:33 PM