Trimming mode for text that does not fit the space available, used by Label.Trimming and LinkButton.Trimming.
Remarks: This is the control equivalent of FormattedTextTrimming, which does the same for text you draw yourself. Trimming only takes effect when the control is given less room than its text needs. It does not change what the control asks the layout for, which is still the width of its full text - constrain the control (a scaled table cell, an explicit width, a parent that limits it) or it will simply be given the room it asked for and never trim. Wrapping and trimming together is only fully supported on WPF and WinUI, where a wrapped control trims the last line that fits. Mac, Gtk, WinForms and iOS say how a line ends with one native setting, and trimming a wrapped control there would mean knowing how many lines it is allowed, which nothing tells them - so when the control also wraps, the wrapping wins and the trimming has no effect. Set WrapMode.None alongside the trimming for behaviour that is the same everywhere. What each platform does with the trimming itself:
- WPF, WinUI, WinForms: both ellipsis modes, natively.
- Mac, Gtk, iOS, Android: an end ellipsis only, so WordEllipsis gets CharacterEllipsis.
- WinForms LinkButton: an end ellipsis only, and LinkButton.Wrap is not implemented - a native LinkLabel lays out its own text.
- Android: Label.Wrap and LinkButton.Wrap are not implemented, so only the trimming applies there.
Enum values
| Name | Value | Description |
|---|---|---|
| None | 0 | No trimming. Text too long for the control is clipped. |
| CharacterEllipsis | 1 | Show an ellipsis after the last character that fits. |
| WordEllipsis | 2 | Show an ellipsis after the last whole word that fits. |