Use Popup to display a hyperlink : Popup « Windows Presentation Foundation « VB.Net






Use Popup to display a hyperlink

Use Popup to display a hyperlink
     



<Window x:Class="ClassicControls.PopupTest"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="PopupTest" Height="300" Width="300">
    <Grid Margin="10">
      <TextBlock TextWrapping="Wrap">text 
         <Run TextDecorations="Underline" MouseEnter="run_MouseEnter">link</Run>
      </TextBlock>
      <Popup Name="popLink" StaysOpen="False" Placement="Mouse" MaxWidth="200" PopupAnimation="Slide" AllowsTransparency = "True">
        <Border BorderBrush="Beige" BorderThickness="2" Background="White">
          <TextBlock Margin="10"  TextWrapping="Wrap" >
            check out
            <Hyperlink NavigateUri="http://java2s.com" Click="lnk_Click">java2s.com</Hyperlink>
          </TextBlock>
        </Border>
      </Popup>
    </Grid>
</Window>
//File:Window.xaml.vb

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes
Imports System.Diagnostics

Namespace ClassicControls
  Public Partial Class PopupTest
    Inherits System.Windows.Window

    Public Sub New()
      InitializeComponent()
    End Sub

    Private Sub run_MouseEnter(sender As Object, e As MouseEventArgs)
      popLink.IsOpen = True
    End Sub
    Private Sub lnk_Click(sender As Object, e As RoutedEventArgs)
      Process.Start(DirectCast(sender, Hyperlink).NavigateUri.ToString())
    End Sub
  End Class
End Namespace

   
    
    
    
    
  








Related examples in the same category

1.Create Popup mock in XamlCreate Popup mock in Xaml
2.Close a Popup with Button clickClose a Popup with Button click
3.PopupAnimation = PopupAnimation.FadePopupAnimation = PopupAnimation.Fade
4.PopupAnimation = PopupAnimation.Scroll;PopupAnimation = PopupAnimation.Scroll;
5.PopupAnimation = PopupAnimation.Slide;PopupAnimation = PopupAnimation.Slide;