This is a migrated thread and some comments may be shown as answers.

changing transition animation at runtime

9 Answers 86 Views
PhoneApplicationFrame
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Cristovao
Top achievements
Rank 1
Cristovao asked on 29 Feb 2012, 03:35 PM
I have my rootframe setup:

  RootFrame = new RadPhoneApplicationFrame();

Now on certain conditions I'd like my page to transtion with RadSwivelTransition  other with RadContinuumAndSlideTransition 


any thoughs on how-to?


9 Answers, 1 is accepted

Sort by
0
Accepted
Todor
Telerik team
answered on 01 Mar 2012, 11:26 AM
Hi Cristovao,

When you want to change the transition, you can do it through the Transition property of the RadPhoneApplicationFrame:

((RadPhoneApplicationFrame)Application.Current.RootVisual).Transition = new RadContinuumAndSlideTransition();

I hope this helps. Let me know if you need additional assistance here.

Greetings,
Todor
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Appy
Top achievements
Rank 1
answered on 02 Mar 2012, 05:23 AM
Transitions are some kind of animation framework that provides different animations. It helps users to add some  attractive visual effects to their apps and implement some typical windows phone animations which are a key part of the metro experience.





---------------
0
Vitalii
Top achievements
Rank 2
answered on 06 Oct 2013, 05:02 PM
And how to set page transition dynamically?

I defined it globally for all pages
var frame = new RadPhoneApplicationFrame
    {
        Transition = new RadSlideAndSwivelTransition()     
    };
 
RootFrame = frame;

I overloaded it for one page 
<telerikPrimitives:RadTransitionControl.Transition>
        <telerikPrimitives:RadFadeTransition/>
    </telerikPrimitives:RadTransitionControl.Transition>

And now i'd like to run this animation only once. Since that, i'd like to set another animation for this page. How can i do that? Transition doesnt have a name, so i cent refer it.
0
Todor
Telerik team
answered on 10 Oct 2013, 08:53 AM
Hello Vitalii,

You can use RadTransitionControl's static method SetTransition in order to set a specific transition for some of your pages. For example, you can override OnNavigatedTo and set it to one transition in the beginning and another next time. Here's an example:
static bool isFirst = true;
 
protected override void OnNavigatedTo(NavigationEventArgs e)
{
    base.OnNavigatedTo(e);
 
    if (e.NavigationMode == NavigationMode.Back)
    {
        return;
    }
 
    if (isFirst)
    {
        RadTransitionControl.SetTransition(this, new RadSlideTransition());
        isFirst = false;
    }
    else
    {
        RadTransitionControl.SetTransition(this, new RadFadeTransition());
    }
}

This way you will have Slide Transition first time and then Fade Transitions.

I hope this information helps.

Regards,
Todor
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Vitalii
Top achievements
Rank 2
answered on 10 Oct 2013, 02:24 PM
Nice, thanks.

How can i speed up page loading (maybe pre-load some elements or styles)?
I have a splashscreen, and then a pivot, but animation of first pivot appearance is almost not visible: it just slows down a bit, and then page appears without animation.
0
Deyan
Telerik team
answered on 15 Oct 2013, 11:43 AM
Hi Vitalii,

Thanks for writing.

Pre-loading styles cannot be done in a straightforward manner on Windows Phone. You should use some tricks to achieve that. For instance, you can first display a page with a busy indicator and fetch the needed data. Once the data is fetched, you can simply navigate to your main page and remove the busy indicator page from the back stack. We do that with our Telerik Examples demo app.

Regards,
Deyan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Vitalii
Top achievements
Rank 2
answered on 15 Oct 2013, 02:24 PM
Yep, i'm switching for this approach right now (before, i started loading in OnNavigatedTo), which made pages quite glitchy. Using OnLoaded makes transaction much smoothier.

But i have main pivot page, which takes some time to be loaded on its own.

Anyway, thanks for answer and recommendation!
0
Vitalii
Top achievements
Rank 2
answered on 16 Oct 2013, 11:29 AM
Well.. problem is that OnNavigatedTo is called before animation starts. So does Loaded.

On the other hand, OnNavigatedFrom() is called after animation finish (so i see intro animation 2 times).

Is there another event, which fires after To animation finished, or before From animation starts?
0
Todor
Telerik team
answered on 18 Oct 2013, 12:49 PM
Hello Vitalii,

I'm not sure I understand exactly your scenario, but here are the options that you have when it comes to the transitions between pages.

1. You initiate navigation. This point is before the transitions.
2. The new page's constructor, old page's OnNavigatedFrom and new page's OnNavigatedTo are fired. This points are after the old page's transition is finished and before the new page's transition has started.
3. After the transition of the new page is finished RadTransitionControl's NewContentTransitionEnded event is fired. If this is the place where you need to execute your logic, you will need to get the instance of RadTransitionControl, so that you can subscribe to its event. You can use or ElementTreeHelper:
RadTransitionControl transitionControl = ElementTreeHelper.FindVisualDescendant<RadTransitionControl>(App.Current.RootVisual);

I hope this information helps.

Regards,
Todor
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
PhoneApplicationFrame
Asked by
Cristovao
Top achievements
Rank 1
Answers by
Todor
Telerik team
Appy
Top achievements
Rank 1
Vitalii
Top achievements
Rank 2
Deyan
Telerik team
Share this question
or