The need to solve the problem of cropping text

We are facing the problem of clipping text in the TextBlock.

We have the text "My very long label goes here" and we need to display it in the following format:

[... g label goes here]

ie right alignment and text should be cropped to the left (character ellipse on the left side)

We used the FlowDirection from the TextBlock, the ellipsis is shown correctly on the left side, but the text is cut off on the right side.

FlowDirection = "LeftToRight:"

[My very long laboratory ...]

FlowDirection = "RightToLeft:"

[... my very long laboratory]

But we need:

[... g label goes here]

Please provide suggestions on this matter.

+2


a source to share


1 answer


You didn't mention how the TextBlock gets its string, but if it's bound to a binding, have you considered using a value converter to just trim the string?



I guess this also only applies if your requirement is the number of X characters before cropping, not if your requirement is Y number of pixels.

+1


a source







All Articles