Skip to content

Latest commit

 

History

History
42 lines (25 loc) · 2.46 KB

hyperlinkbutton_navigateuri.md

File metadata and controls

42 lines (25 loc) · 2.46 KB
-api-id -api-type
P:Microsoft.UI.Xaml.Controls.HyperlinkButton.NavigateUri
winrt property

Microsoft.UI.Xaml.Controls.HyperlinkButton.NavigateUri

-description

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

-xaml-syntax

<HyperlinkButton NavigateUri="uriString"/>

-property-value

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

-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 WebView2 control that's also part of your app, then don't specify a value for NavigateUri. Handle the Click event instead, and set the WebView2.Source property to the URI to load.

-examples

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

[!code-xamlBasicHyperlinkButtonXAML]

-see-also

Hyperlinks