I would like to add a button to the Settings charms bar called 'Privacy Policy' that links to the url:

    http://yourdomain.com/privacypolicy

I am creating a Windows 8 application using visual studio and VB

有帮助吗?

解决方案 2

The vb code in your App.xaml.vb file :

    Imports Windows.UI.ApplicationSettings

Place in the onlaunched sub

    AddHandler SettingsPane.GetForCurrentView.CommandsRequested, Sub(sender, e)         e.Request.ApplicationCommands.Add(New SettingsCommand("privacy", "Online Privacy Policy", Sub() privacyGo()))

Create a sub

    Private Sub privacyGo()

    Dim privacy As New Uri("http://myprivacy.com")

    Windows.System.Launcher.LaunchUriAsync(privacy)

End Sub

其他提示

In app.xaml.cs

protected override void OnWindowCreated(WindowCreatedEventArgs args)
{
    SettingsPane.GetForCurrentView().CommandsRequested += (s, e) =>
    {
        SettingsCommand defaultsCommand = new SettingsCommand("privacy", "Privacy Policy",
            (handler) =>
            {
                //open the URL
                Launcher.LaunchUriAsync(new Uri("http://yourdomain.com/privacypolicy"));
            });
        e.Request.ApplicationCommands.Add(defaultsCommand);
    };

    base.OnWindowCreated(args);
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top