Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add CharacterEllipsis at the beginning of the textblock in wpf?

I have a TextBlock with TextTrimming = TextTrimming.CharacterEllipsis and I want the dots to appear at the beginging. Is there a property for this?

For example if I have the text "123456789ABCDEF" it is displayed "12345678...", but I want it "...89ABCDEF".

Thanks

like image 468
Gabriel Diaconescu Avatar asked Nov 29 '10 09:11

Gabriel Diaconescu


People also ask

Can we edit TextBlock in WPF?

TextBlock is not editable. Use TextBox instead. Save this answer.

How do I create a line break in TextBlock WPF?

Adding Line Breaks You can do this with a LineBreak inline, added as an XAML element within the text. A new line will be started at the position of this element. If you have configured the text to be justified, the final line before the line break will not be expanded to fill the available width.

What is the difference between TextBlock and label in WPF?

Labels usually support single line text output while the TextBlock is intended for multiline text display. For example in wpf TextBlock has a property TextWrapping which enables multiline input; Label does not have this.

What is text trimming?

TRIM will remove extra spaces from text. Thus, it will leave only single spaces between words and no space characters at the start or end of the text. It is very useful when cleaning up text from other applications or environments. TRIM only removes the ASCII space character (32) from the text.


1 Answers

I had a go at messing about with FlowDirection, it renders the ... at the beginning but still started with 1234 etc.

I did however come across this very similar question:

Ellipsis at start of string in WPF ListView

Someone there has a routine to do it manually. Hope that helps :)

like image 190
Tom Avatar answered Nov 15 '22 05:11

Tom