locked
How to set the size of app as 320px when lanching ie10 by the app. RRS feed

  • Question

  • Hello All,

    I have a metro app, and there is a page and a button in the page.

    When I click the button, I will call the method "Windows.System.Launcher.LaunchUriAsync(fallbackUri)" to start ie10.

    Then the ie10 is started as the right of screen, and my metro app displays in the left of screen.

    But the size of my metro app  is lager than 320, I want to set the size of my app to 320px in this case.

    How should I do? 

    Thursday, October 31, 2013 9:28 AM

Answers

  • Hi Shirley,

    in the Package.appxmanifest set the Minimum Width to 320px. The default-value is 500px.

    Now when launching an Uri, you just need to tell the Launcher that you want your app to be displayed with the minimum. You do this by passing in a configured LauncherOptions-Instance as second parameter to the LaunchUriAsync-method. Below a snippet that shows exactly what you should do:

    private async void Button_Click(object sender, RoutedEventArgs e)
    {
        var options = new LauncherOptions{
        DesiredRemainingView = ViewSizePreference.UseMinimum
        };
        await Windows.System.Launcher.LaunchUriAsync(new Uri("http://www.thomasclaudiushuber.com"), options);
    }


    Thomas Claudius Huber

    "If you can´t make your app run faster, make it at least look & feel extremly fast"

    twitter: @thomasclaudiush
    homepage: www.thomasclaudiushuber.com
    author of: ultimate Windows Store Apps handbook | ultimate WPF handbook | ultimate Silverlight handbook

    • Marked as answer by Shirley-cheng Friday, November 1, 2013 1:12 AM
    Thursday, October 31, 2013 10:35 AM

All replies

  • Hi Shirley,

    in the Package.appxmanifest set the Minimum Width to 320px. The default-value is 500px.

    Now when launching an Uri, you just need to tell the Launcher that you want your app to be displayed with the minimum. You do this by passing in a configured LauncherOptions-Instance as second parameter to the LaunchUriAsync-method. Below a snippet that shows exactly what you should do:

    private async void Button_Click(object sender, RoutedEventArgs e)
    {
        var options = new LauncherOptions{
        DesiredRemainingView = ViewSizePreference.UseMinimum
        };
        await Windows.System.Launcher.LaunchUriAsync(new Uri("http://www.thomasclaudiushuber.com"), options);
    }


    Thomas Claudius Huber

    "If you can´t make your app run faster, make it at least look & feel extremly fast"

    twitter: @thomasclaudiush
    homepage: www.thomasclaudiushuber.com
    author of: ultimate Windows Store Apps handbook | ultimate WPF handbook | ultimate Silverlight handbook

    • Marked as answer by Shirley-cheng Friday, November 1, 2013 1:12 AM
    Thursday, October 31, 2013 10:35 AM
  • Thank you! 

    It works well!

    Friday, November 1, 2013 1:12 AM