本文介绍了如何使用C#在** winrt **应用程序中查看特定的设置页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从外部按钮单击使用C#在 winrt 应用程序中查看特定设置页面?
how to view specific setting page in winrt application using C# from outside button click?
在javascript中,我发现这样的 WinJS.UI.SettingsFlyout.showSettings("About","/Settings/About.html")
In javascript i found like this WinJS.UI.SettingsFlyout.showSettings("About", "/Settings/About.html")
但是我无法在c#中找到它,我正在使用 callisto 设置弹出按钮
But i could not able to find this in c#,I am using callisto for Setting Flyouts
推荐答案
我也使用Callisto和C#,这就是我解决问题的方式.
I'm using Callisto and C# too, and this is how I solved the problem.
void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
var settings = new SettingsCommand("settings", "Settings", new UICommandInvokedHandler(showSettings));
args.Request.ApplicationCommands.Add(settings);
var credits = new SettingsCommand("credits", "Credits", new UICommandInvokedHandler(showCredits));
args.Request.ApplicationCommands.Add(credits);
}
public void showSettings(IUICommand command)
{
var settings = new SettingsFlyout();
settings.Content = new SettingsUserControl();
settings.HeaderBrush = new SolidColorBrush(_background);
settings.Background = new SolidColorBrush(_background);
settings.HeaderText = "Settings";
settings.IsOpen = true;
}
public void showCredits(IUICommand command)
{
var settings = new SettingsFlyout();
settings.Content = new CreditsUserControl();
settings.HeaderBrush = new SolidColorBrush(_background);
settings.Background = new SolidColorBrush(_background);
settings.HeaderText = "Credits";
settings.IsOpen = true;
}
然后从其他页面我可以打电话
Then from other pages I can just call
((App)Application.Current).showCredits(null);
或
((App)Application.Current).showSettings(null);
要调出设置窗格,我想看看:o)
To bring up the settings pane I want to see :o)
这篇关于如何使用C#在** winrt **应用程序中查看特定的设置页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!