Dela via


HyperlinkButton.NavigateUri Property

Definition

Gets or sets the Uniform Resource Identifier (URI) to navigate to when the HyperlinkButton is clicked.

public:
 property Uri ^ NavigateUri { Uri ^ get(); void set(Uri ^ value); };
Uri NavigateUri();

void NavigateUri(Uri value);
public System.Uri NavigateUri { get; set; }
var uri = hyperlinkButton.navigateUri;
hyperlinkButton.navigateUri = uri;
Public Property NavigateUri As Uri
<HyperlinkButton NavigateUri="uriString"/>

Property Value

The Uniform Resource Identifier (URI) to navigate to when the HyperlinkButton is clicked.

Examples

Here's a HyperlinkButton as declared in XAML. It declares a string value for Content and also a NavigateUri value.

<HyperlinkButton Content="www.microsoft.com" NavigateUri="http://www.microsoft.com"/>

Remarks

When a user clicks or otherwise invokes a HyperlinkButton, it opens the URI you specified for the NavigateUri property in the default browser.

You don't have to use http: or https: schemes for the URI. 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.

HyperlinkButton is a control, so it has input events such as Tapped, and it's a ButtonBase subclass so it also has a Click event. You don't typically specify a value for NavigateUri and also handle input events that are interpreted as clicking the HyperlinkButton. The action of opening the NavigateUri in a default browser is a system action that takes place without requiring any event handling. If your intent is that the HyperlinkButton 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.

Applies to

See also