Auto clip and append dots in WPF label Auto clip and append dots in WPF label wpf wpf

Auto clip and append dots in WPF label


Put a TextBlock inside your label and set TextTrimming to CharacterEllipsis or WordEllipsis

<Label>     <TextBlock TextTrimming="CharacterEllipsis">Hello World</TextBlock></Label>


It's also possible to use AccessText within the Label like this:

<StackPanel Orientation="Horizontal"><Label VerticalAlignment="Center" Width="50"        Target="{Binding ElementName=txtName}">    <AccessText Text="_First Name" TextTrimming="CharacterEllipsis"  /></Label><TextBox Name="txtName" VerticalAlignment="Center" Width="120"/>

With this solution the access key for a control (e.g. Alt+F) still works.