Search code examples
c#silverlightwindows-phone-7silverlight-toolkit

Apply Transition with Silverlight Toolkit to Grid containing Canvas in Windows Phone 7


Let me explain you the scenario

I am developing for Windows Phone 7 and have a page on which there is a button. At the buttons click event I have added the code to show the Canvas Panel that is present on the page

Canvas1.Visibility = System.Windows.Visibility.Visible;

This enables to pop up the Canvas instantly, now what I want is that this canvas should be visible with the turnstile transition effect provided in the silverlight toolkit for Windows Phone 7.

How do I apply the transition on the Canvas only.


Solution

  • You need something like:

        TurnstileTransition turnstileTransition = new TurnstileTransition { Mode = TurnstileTransitionMode.BackwardIn};
        ITransition transition = turnstileTransition.GetTransition(Canvas1);
        transition.Completed += delegate
        {
            transition.Stop();
        };
        transition.Begin();
    

    GetTransition(UIElement element) creates a new ITransition for the specified UIElement.

    note:Handling of the Completed event is optional and it depends on the specified animation.