O'Reilly logo

Windows Application Development Cookbook by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Opening a website in a default browser

In the first recipe, you will learn how to open a given website in a default browser available in the system. Such a task is really easy and just requires you to provide a URL of the website for the LaunchUriAsync method. Let's start!

Getting ready

To step through this recipe, you need only the automatically generated project.

How to do it...

To prepare an example that opens a website in a default browser available in the system, perform the following steps:

  1. Add a button (opening a website in a default web browser) to the page by modifying the content of the MainPage.xaml file, as follows:
            <Page (...)> 
                <StackPanel (...)> 
                    <Button 
                        Content="Open website" (...) 
                        Click="BtnOpenWebsite_Click" /> </StackPanel> </Page> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required