SettingsCommand可以回调​​Windows应用程序吗? [英] Can a SettingsCommand call back to the Windows app?

查看:81
本文介绍了SettingsCommand可以回调​​Windows应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的C#/ XAML Windows 8应用程序中有一个SettingsCommand。它完美地运作。但是,我提供的选项之一是允许用户重置应用程序中的所有数据。这也很有效。



但是,当用户打开设置魅力时正在查看的实际XAML页面需要刷新自己。有没有办法打电话给当前打开的页面?或者参考一下?或者将页面的引用传递给SettingsCommand?



甚至让页面识别出魅力栏已被打开?像聚焦/未聚焦一样。那种活动?



或者,是否可以从SettingsCommand UserControl导航到我的应用程序的特定页面?

I have a SettingsCommand in my C#/XAML Windows 8 app. It works perfectly. However, one of the options I provide is to allow the user to reset all of their data in the app. This also works perfectly.

However, the actual XAML page that was being viewed when the user opened the settings charm needs to refresh itself. Is there a way to make a call to the page that is currently open? Or get a reference to it? Or pass a reference of the page to the SettingsCommand?

Or even have the page recognize that the charms bar has been opened? Like a "focused"/"unfocused" kind of event?

Or, would it be possible to just navigate to a specific page of my app FROM the SettingsCommand UserControl?

推荐答案

结果我只需要获得对Window.Current.Content的引用。



Turns out I just needed to get a reference to Window.Current.Content.

Frame rootFrame = Window.Current.Content as Frame;
rootFrame.Navigate(typeof(MainPage));


这篇关于SettingsCommand可以回调​​Windows应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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