Add hyperlink to textblock WPF

Displaying is rather simple, the navigation is another question. XAML goes like this: <TextBlock Name=”TextBlockWithHyperlink”> Some text <Hyperlink NavigateUri=”http://somesite.example” RequestNavigate=”Hyperlink_RequestNavigate”> some site </Hyperlink> some more text </TextBlock> And the event handler that launches default browser to navigate to your hyperlink would be: private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e) { System.Diagnostics.Process.Start(e.Uri.ToString()); } To do it with … Read more

How to a add a command to a WPF TextBlock?

You can use a InputBinding. <TextBlock Text=”Hello”> <TextBlock.InputBindings> <MouseBinding Command=”” MouseAction=”LeftClick” /> </TextBlock.InputBindings> </TextBlock> Edit: Hyperlink is probably worth a mention too. <TextBlock><Hyperlink Command=”” TextDecorations=”None” Foreground=”Black”>Hello</Hyperlink></TextBlock>