Windows Dev Center

Hyperlink.NavigateUri property

Gets or sets the Uniform Resource Identifier (URI) to navigate to when the Hyperlink is activated.

Syntax


public Uri NavigateUri { get; set; }


<Hyperlink NavigateUri="uriString"/>

XAML Values

uriString

A URI represented in string form. This is usually an absolute URI and usually includes the scheme (for example "http://"). XAML can interpret relative URIs to be relative from the XAML file's location in the app, but this isn't a common usage for a Hyperlink. See Remarks.

Property value

Type: System.Uri [.NET] | Windows::Foundation::Uri [C++]

The URI to navigate to when the Hyperlink is activated. The default is null.

Remarks

By default, a Hyperlink appears as a text hyperlink. When a user clicks it, it opens the URI you specify in the NavigateUri property in the default browser. (More specifically, it launches in the app that's registered for the particular scheme/protocol as you specified in the NavigateUri value.) The default browser is a separate process from your app. The typical user experience is that a new browser app appears as a split pane alongside your app, and the browser gets focus.

You don't need to handle the Click event to cause the navigation when you specify a value for NavigateUri. The Click event is intended for navigation within the app, for example if you want a new app page to load, and for that scenario you don't need a NavigateUri value. There's also nothing you can do within the Click event handler to prevent the default browser from loading any valid target specified for NavigateUri; that action takes place automatically (asynchronously) when the hyperlink is activated and can't be canceled from within the Click event handler.

If your intent is that the Hyperlink should load a specified URI within a WebView control that's also part of your app, then don't specify a value for NavigateUri. Handle the Click event instead, and call WebView.Navigate, specifying the URI to load.

You don't have to use http: or https: schemes. You can use schemes such as ms-appx:, ms-appdata:, or ms-resources:, if there's resource content at these locations that's appropriate to load in a browser. However, the file: scheme is specifically blocked. For more info, see URI schemes.

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml.Documents
Windows::UI::Xaml::Documents [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Documents
Windows::UI::Xaml::Documents [C++]

Metadata

Windows.winmd

See also

Hyperlink
Click event

 

 

Show:
© 2015 Microsoft