One. Using the Windows window
1. Click the link to open with the system default viewer
< textblock margin = "10,20,-10,-20" > Span style= "color: #000000;" > default: < hyperlink navigateuri = "http://www.tianma3798.cn" click = "Hyperlink_click" > www.tianma3798.cn</ hyperlink > </ textblock >
Private void Hyperlink_click (object sender, RoutedEventArgs e) { as Hyperlink; Process.StartNew processstartinfo (link. Navigateuri.absoluteuri));}
2. Configure the default hyperlink link style
Defining Style resources
<!--Integration Resources -<Stylex:key= "Hyberlinkeffect"TargetType="{x:type Hyperlink}"> <Setter Property= "Foreground"Value= "#3d6490"></Setter> <Setter Property= "Textblock.textdecorations"Value="{x:null}"></Setter> <style.triggers> <Trigger Property= "IsMouseOver"Value= "True"> <Setter Property= "Foreground"Value= "Green"></Setter> <!--Show underline on mouse hover - <Setter Property= "Textblock.textdecorations"> <Setter.value> <textdecorationcollection> <textdecoration Location= "Underline"/> </textdecorationcollection> </Setter.value> </Setter> </Trigger> </style.triggers></Style>
Working with resources
<TextBlockMargin= "10,56,-10,-56" >using style resources:<HyperlinkNavigateUri= "http://www.tianma3798.cn"ToolTip= "Welcome to visit, Love Network"Style="{StaticResource Hyberlinkeffect}" >www.tianma3798.cn</Hyperlink></TextBlock>
Show Results:
Second, use in page or IFRAME
< TextBlock > < navigateuri= "http://www.baidu.com" > Baidu home </ Hyperlink></TextBlock>
WPF Hyperlink Hyperlink control uses