在MetroStyle应用程序中删除BackStack条目 [英] Removing the BackStack Entry in MetroStyle Application

查看:70
本文介绍了在MetroStyle应用程序中删除BackStack条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Metro风格的应用程序中实现删除backStack条目?

How can I implement removing the backStack Entry in Metro style applications?

推荐答案

我发现此答案很有用:

如何清除Backstack并重新开始

编写您自己的NavigationService并将导航状态存储在构造函数中.

Write your own NavigationService and store the navigationstate in the constructor.

string state;

public NavigationService(Frame mainFrame)
{
    state = mainFrame.GetNavigationState();

_mainFrame = mainFrame;
_mainFrame.Navigating += _mainFrame_Navigating;
}

然后在服务上实现此方法,并在需要时调用它:

Then implement this method on the service and call it when needed:

    public void ClearBackstack()
    {
        _mainFrame.SetNavigationState(state);
    }

这篇关于在MetroStyle应用程序中删除BackStack条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆