Partilhar via


Create a hyperlink in a Page document

This page applies to WPF projects only

You can create a hyperlink inside a TextBlock object in a Page document that will navigate to another Page document in your application, or to a web page.

Important

You can create hyperlinks only in a Page document (on the File menu, select New Item) and thus in a NavigationWindow element. The linked-to topic must be a Page document in your application, or a web page. Additionally, you can apply a hyperlink to text only if the text is contained in a TextBlock. If you want to create a hyperlink that opens an Internet browser, you need to create a custom control or an event handler that responds to a mouse click. For more information see Try it: Create a hyperlink that opens a browser window. Another option is to create a TextBlock inside a Frame object (available in the Asset Library) in a Window document, and then paste a link into the TextBlock object. The Frame object will act like a mini browser window in your application.

  1. In the Toolbox, click either the SelectionCc294844.2ff91340-477e-4efa-a0f7-af20851e4daa(en-us,Expression.10).png tool or the Direct SelectionCc294844.6dd6571f-c116-451d-8dd2-1f88b8406362(en-us,Expression.10).png tool.

  2. Click to select the TextBlock object to which you want to add a hyperlink, right-click the object, and then click Edit Text.

  3. Do one of the following:

    • To apply a hyperlink to existing text, drag to select the text.

    • To create a hyperlink from scratch, click where you want the hyperlink text to appear.

  4. In the Properties panel, under Text, on the FontCc294844.17db489b-22e6-4b99-9a19-fa1ed9d51e7e(en-us,Expression.10).png tab, click Hyperlink Cc294844.d2081be0-6c8a-4861-9bef-c08dfb040102(en-us,Expression.10).png.

  5. In the Create Hyperlink dialog box, enter the text that you want to be hyperlinked next to Hyperlink Text, enter the URL or URI (Universal Resource Identifier) for the link next to Hyperlink URI, and then click OK.

See also

Concepts

Try it: Create a hyperlink that opens a browser window

Create a hyperlink in a Silverlight application