locked
Creating a shortcut in the appbar. windows phone 8 RRS feed

  • Question

  • Hi

    I have created a simple button that takes the user to the phones settings so he can disable/enable location.

    settings.xaml.cs:

     private void buttonGps_click(object sender, RoutedEventArgs e)
            {
                Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-location:"));
            }

    I have an appbar that is working tried it with a simple link to another page I created.

    app.xaml.cs:

     private void Settings_Click(object sender, EventArgs e)
            {
                (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/settings.xaml", UriKind.RelativeOrAbsolute));
            }

    so now to my question I wanna have the user moved to the location settings when they press the appbars button, any advice on this? 


    • Edited by Joacke_a Tuesday, February 3, 2015 2:07 PM
    Tuesday, February 3, 2015 1:25 PM

Answers

  • You should be able to put your LaunchUriAsync call in the Settings_Click event instead of the Navigate call.   Is that not working?

    Bret Bentzinger (MSFT) @awehellyeah

    • Marked as answer by Joacke_a Wednesday, February 4, 2015 8:31 AM
    Tuesday, February 3, 2015 9:32 PM

All replies

  • You should be able to put your LaunchUriAsync call in the Settings_Click event instead of the Navigate call.   Is that not working?

    Bret Bentzinger (MSFT) @awehellyeah

    • Marked as answer by Joacke_a Wednesday, February 4, 2015 8:31 AM
    Tuesday, February 3, 2015 9:32 PM
  • Hi Bret!

    Thanks for the reply, your right it's working, I made some error elsewhere in the code that's why it didn't work first time.


    Wednesday, February 4, 2015 8:31 AM