Wpf 通用Windows平台页面保留

Wpf 通用Windows平台页面保留,wpf,xaml,uwp,Wpf,Xaml,Uwp,在通用Windows平台中,有没有保持页面活动的方法?假设我正在输入一个新客户,在某个时候我意识到我想要分配的类别尚未创建,所以我想导航到另一个页面来添加该类别,但我不希望当前页面被破坏并丢失数据。在WPF中,使用PRISM KeepAlive这个场景非常简单 谢谢您可以通过设置导航缓存模式属性来缓存页面及其内容。此属性的默认设置为禁用,因此您必须在构造函数中手动设置它: public MyPage() { // The page will only be cached, //

在通用Windows平台中,有没有保持页面活动的方法?假设我正在输入一个新客户,在某个时候我意识到我想要分配的类别尚未创建,所以我想导航到另一个页面来添加该类别,但我不希望当前页面被破坏并丢失数据。在WPF中,使用PRISM KeepAlive这个场景非常简单


谢谢

您可以通过设置
导航缓存模式
属性来缓存页面及其内容。此属性的默认设置为禁用
,因此您必须在构造函数中手动设置它:

public MyPage()
{
    // The page will only be cached,
    // if the cache size of the parent Frame is large enough for this page
    NavigationCacheMode = NavigationCacheMode.Enabled;

    // The page will always be cached,
    // even if it exceeds the cache size of the parent Frame
    NavigationCacheMode = NavigationCacheMode.Required;
}

有关更多详细信息,请查看MSDN上的主题。

谢谢您的回答,我将在今晚查看:)