Use Run the mark underlink TextDecorations : TextBlock Style « Windows Presentation Foundation « C# / CSharp Tutorial






<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.cs

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

namespace ClassicControls
{
    public partial class PopupTest : System.Windows.Window
    {

        public PopupTest()
        {
            InitializeComponent();
        }

        private void run_MouseEnter(object sender, MouseEventArgs e)
        {
            popLink.IsOpen = true;
        }
        private void lnk_Click(object sender, RoutedEventArgs e)
        {
            Process.Start(((Hyperlink)sender).NavigateUri.ToString());
        }
    }
}
WPF Use Run The Mark Underlink Text Decorations








24.8.TextBlock Style
24.8.1.Emboss TextEmboss Text
24.8.2.Engrave TextEngrave Text
24.8.3.Text Drop ShadowText Drop Shadow
24.8.4.Empirical Tilted Text ShadowEmpirical Tilted Text Shadow
24.8.5.Fill the overline decoration with a linear gradient brush in C#Fill the overline decoration with a linear gradient brush in C#
24.8.6.Fill the baseline decoration with a linear gradient brush in C#Fill the baseline decoration with a linear gradient brush in C#
24.8.7.Fill the underline decoration with a solid color brush in C#Fill the underline decoration with a solid color brush in C#
24.8.8.Fill the strikethrough decoration with a solid color brush in C#Fill the strikethrough decoration with a solid color brush in C#
24.8.9.Simple underline decorationSimple underline decoration
24.8.10.Use Run the mark underlink TextDecorationsUse Run the mark underlink TextDecorations
24.8.11.Format Text by changing the font size
24.8.12.Change font to Italic
24.8.13.Changing font to bold
24.8.14.Combine bold and italic style
24.8.15.Wrap the text