Auto clip and append dots in WPF label

Ramesh Soni picture Ramesh Soni · Jun 8, 2010 · Viewed 20.4k times · Source

How can I auto clip text and append dots on a label if the current text doesn't fits to its width in WPF?

Answer

Ray picture Ray · Jun 8, 2010

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

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