Madalina
Madalina

Reputation: 31

Frame.GoBack(NavigationTransitionInfo) callback

I want to scroll down to bottom of a GridView when navigating back from another page.To be more specific exactly when Frame.GoBack(NavigationTransitionInfo) ends, so the scrolling would be visible. There is a callback or some way to notify when the transition ended?

Upvotes: 3

Views: 94

Answers (1)

Nico Zhu
Nico Zhu

Reputation: 32775

I was wondering if GoBack() has a callback or notifies when the page transition ended

GoBack has no call back, so you can't detect transition ended with GoBack method. For your requirement, You could make custom callback method with Action.

Page1

public sealed partial class BlankPage1 : Page
{
    public BlankPage1()
    {
        this.InitializeComponent();
    }
    private static Action _callBackAction;
    private void Button_Click(object sender, RoutedEventArgs e)
    {
        Frame.GoBack();
        Task.Delay(TimeSpan.FromSeconds(1)).ContinueWith((task)=> {

            _callBackAction();
        });       
    }
    public static void CallBackMethod( Action action)
    {
        _callBackAction = action;

    }
}

Page0

public Page0()
{
    this.InitializeComponent();
    BlankPage1.CallBackMethod(() =>
    {
        //do some stuff

    });    
}

Upvotes: 1

Related Questions