Is there a way to specify text trimming on a TextBlock
to be from the left side?
I've manage to accomplish two out of three scenarios (the third being the one I need):
Regular trimming
<TextBlock
VerticalAlignment="Center"
Width="80"
TextTrimming="WordEllipsis"
Text="A very long text that requires trimming" />
// Result: "A very long te..."
Left trimming
<TextBlock
VerticalAlignment="Center"
Width="80"
FlowDirection="RightToLeft"
TextTrimming="WordEllipsis"
Text="A very long text that requires trimming." />
// Result: "...A very long te"
Left trimming where the end of the text is seen
// Desired result: "...uires trimming"
Does anyone know if this is possible? Thanks.
If you don't care about the ellipses, but just want to see the end of the text instead of the beginning when it gets cut-off, you can wrap the TextBlock inside another container, and set its HorizontalAlignment to Right. This will cut it off just like you want, but without the elipse.
<Grid>
<TextBlock Text="Really long text to cutoff." HorizontalAlignment="Right"/>
</Grid>