Hyperlink WPF in VB.NET

This article defines how to create or use Hyperlink in WPF using XAML.
  • 4270
Download Files:
 

Hyperlink

A hyperlink will show up as a single word or group of words that will usually be marked as underlined, and are frequently blue in color. Clicking on the hyperlink may take one to another part of the page, or it may open another Internet page or, Hyperlink is a A clickable connection that allows you to jump from one word, picture, or information object to another.

To use it within a windows-based application we need to handle the RequestNavigate event and write the code.

 

For example

 

XAML code

 

<Window x:Class="MainWindow"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="MainWindow" Height="350" Width="525">

    <Grid>

        <TextBlock FontSize="20"> Welcome to         

<Hyperlink NavigateUri="http://www.google.com" RequestNavigate="Hyperlink_RequestNavigate">

Google.com

</Hyperlink>

        </TextBlock>

    </Grid>

</Window>

 

 

windows-based application we need to hanlde the RequestNavigate event and write the code.

 

Private Sub Hyperlink_RequestNavigate(ByVal sender As Object, ByVal e As RequestNavigateEventArgs)

        Process.Start(New ProcessStartInfo(e.Uri.AbsoluteUri))

        e.Handled = True

    End Sub

 

Now run the application and test it.

 

h1.gif

 

Figure1.gif

 

Now click on the link google.com and test it.

 

h2.gif

 

Figure2.gif

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.