--- title: "How to: Specify Whether a Hyperlink is Underlined" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "Hyperlink control type [WPF]" ms.assetid: 3996cfe6-1dac-4835-aeb3-c719ce9cfee5 --- # How to: Specify Whether a Hyperlink is Underlined The object is an inline-level flow content element that allows you to host hyperlinks within the flow content. By default, uses a object to display an underline. objects can be performance intensive to instantiate, particularly if you have many objects. If you make extensive use of elements, you may want to consider showing an underline only when triggering an event, such as the event. In the following example, the underline for the "My MSN" link is dynamic, that is, it only appears when the event is triggered. ![Hyperlinks displaying TextDecorations](./media/how-to-specify-whether-a-hyperlink-is-underlined/text-decorations-hyperlinks.png) ## Example The following markup sample shows a defined with and without an underline: [!code-xaml[Performance#PerformanceSnippet11](~/samples/snippets/csharp/VS_Snippets_Wpf/Performance/CSharp/Hyperlink.xaml#performancesnippet11)] The following code sample shows how to create an underline for the on the event, and remove it on the event. [!code-csharp[Performance#PerformanceSnippet15](~/samples/snippets/csharp/VS_Snippets_Wpf/Performance/CSharp/Hyperlink.xaml.cs#performancesnippet15)] [!code-vb[Performance#PerformanceSnippet15](~/samples/snippets/visualbasic/VS_Snippets_Wpf/Performance/visualbasic/hyperlink.xaml.vb#performancesnippet15)] ## See also - - - [Optimizing WPF Application Performance](optimizing-wpf-application-performance.md) - [Create a Text Decoration](how-to-create-a-text-decoration.md)