--- title: "How to: Create a Control That Has an Access Key and Text Wrapping" ms.date: "03/30/2017" helpviewer_keywords: - "access keys [WPF], control for" - "controls [WPF], text wrapping" - "wrapping text [WPF]" - "keys [WPF], control for" - "controls [WPF], access keys" - "text wrapping [WPF]" ms.assetid: 205099d9-2551-4302-a25e-a15af9f67e04 --- # How to: Create a Control That Has an Access Key and Text Wrapping This example shows how to create a control that has an access key and supports text wrapping. The example uses a control to illustrate these concepts. ## Example **Add Text Wrapping to Your Label** The control does not support text wrapping. If you need a label that wraps across multiple lines, you can nest another element that does support text wrapping and put the element inside the label. The following example shows how to use a to make a label that wraps several lines of text. [!code-xaml[LabelSnippet#5](~/samples/snippets/csharp/VS_Snippets_Wpf/LabelSnippet/CS/Pane1.xaml#5)] **Add an Access Key and Text Wrapping to Your Label** If you need a that has an access key (mnemonic), use the element that is inside the . Controls such as , , , , , , , and have default control templates. These templates contain a . One of the properties that you can set on the is ="true", which you can use to specify an access key for the control. The following example shows how to create a that has an access key and supports text wrapping. To enable text wrapping, the example sets the property and uses an underline character to specify the access key. (The character that immediately follows the underline character is the access key.) [!code-xaml[LabelSnippet#4](~/samples/snippets/csharp/VS_Snippets_Wpf/LabelSnippet/CS/Pane1.xaml#4)] ## See also - [How to: Set the Target Property of a Label](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms752101(v=vs.90))