Vertical position of wrapping label text not consistent - how to keep the position the same?

GabiGabi DEMember ✭✭

There's a problem with the vertical position of a label text in my specific case.
The vertical position of a wrapping label text is changing when the text becomes too long to fit in the given layout.

When the text is only two lines and does fit in the available space everything is fine:
See attached file "LayoutProblem_twolines"

As soon as the text becomes too long for the available space and therefore wraps into a (not visible) third line, its position is moved several pixels downwards:
See attached file "LayoutProblem_threelines"

Any ideas on why the position changes when the text becomes too long? And is there maybe a possibility to keep the position of the text the same although it doesn't fit in the available space? Any ideas are highly appreciated.

Here's the corresponding xaml for the concerned elements:
See attached file "LayoutProblem_xaml"

Answers

  • KellyHussKellyHuss USMember ✭✭
    edited October 25

    You could try adding:
    LineBreakMode="TailTruncation"
    in your label tag. This should cut off the end and add ... instead of forcing it to wrap.

  • GabiGabi DEMember ✭✭

    Thanks for your answer. The LineBreakMode works fine if one wants to truncate the text at the end of the first line. In my case I would need the text to be truncated at the end of the second line. Is there a possibility to define the amount of lines that are visible before the text is truncated?

Sign In or Register to comment.