通用 Windows 平台页面 KeepAlive
Universal Windows Platform Page KeepAlive
在 Universal Windows 平台中,有没有办法让页面保持活动状态?假设我正在输入一个新客户,并且在某个时候我意识到我想要分配的类别尚未创建,所以我想导航到另一个页面以添加该类别但我不希望当前页面被破坏并丢失数据。在 WPF 中,这种情况使用 PRISM KeepAlive 非常简单。
谢谢
您可以通过设置 NavigationCacheMode
属性 缓存页面及其内容。这个属性的默认设置是Disabled
,所以你必须在你的构造函数中手动设置它:
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 上的 Quickstart: Navigating between pages 主题。
在 Universal Windows 平台中,有没有办法让页面保持活动状态?假设我正在输入一个新客户,并且在某个时候我意识到我想要分配的类别尚未创建,所以我想导航到另一个页面以添加该类别但我不希望当前页面被破坏并丢失数据。在 WPF 中,这种情况使用 PRISM KeepAlive 非常简单。
谢谢
您可以通过设置 NavigationCacheMode
属性 缓存页面及其内容。这个属性的默认设置是Disabled
,所以你必须在你的构造函数中手动设置它:
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 上的 Quickstart: Navigating between pages 主题。