Improved Text Trimming support #9289
Labels
area-TextBlocks
TextBlock, RichTextBlock
feature proposal
New feature proposal
team-Controls
Issue for the Controls team
Proposal: Custom text trimming support
Summary
Introduce a way that developers can customize the text trimming of TextBox content easily.
Rationale
I'm displaying a folder path in my app. If the path is too long the end is trimmed and replaced with an ... (ellipse), because I set
TextTrimming="CharacterEllipsis"
. That is a bad way to trim folder paths as the two relevant parts for users are the beginning and the end of a file path. They want to see what drive is this on and what file is it exactly.Example:
"C:\Users\Marvin\Documents\Projects\Cool-Project\v1\Draft 2.txt"
this path should not be shown as "C:\Users\Marvin\Documents\Projects..." that not useful.
Instead something like "C:\Users...\Cool-Project\v1\Draft 2.txt" would be elegant and useful.
There are quite a few data-types that should have custom trimming to conserve the usefulness of a trimmed string:
Scope
Important Notes
Developers should not have to include an ellipse in the Text property of a TextBlock and update the Text property continuely from a SizeChanged event.
One way to accomplish this would be to include the original string, the space available and the shorted string in the IsTextTrimmedChangedEventArgs, so that devs can subscribe to that event and manipulate the shortened string in the args.
A new property on TextBlock that allows devs to pass a trimming function would be another way to implement this functionality.
Open Questions
Could a few more trimming options also satisfy this need?
The text was updated successfully, but these errors were encountered: