I have a WPF ListView (GridView) and the cell template contains a TextBlock. If I add: TextTrimming=\"CharacterEllipsis\" TextWr
I implemented (copied) the above TextBlockTrimmer code and it worked great for loading but the TextBlock.Text would not update afterwards, if bound to a View Model property that changed.
What I found that worked was to
TextBlockText in TextBlockTrimmer, similar to the EllipsisPosition property above, including an OnTextBlockTextChanged() method.OnTextBlockTextChanged() method, set _originalText to newValue before calling TrimText().TextBlockText property to the View Model property (called SomeText in the XAML below)Bind the TextBlock.Text property to the TextBlockTrimmer.TextBlockText property in the XAML:
It also worked if I bound both TextBlockTrimmer.TextBlockText and TextBlock.Text to SomeText (but doing so bugs me).