Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextBlock TextTrimming=CharacterEllipsis, TextWrapping=Wrap, MaxLines="2" does not always show ellipsis #17633

Open
wieslawsoltes opened this issue Nov 28, 2024 · 1 comment
Labels

Comments

@wieslawsoltes
Copy link
Collaborator

Describe the bug

TextBlock TextTrimming=CharacterEllipsis with TextWrapping=Wrap and MaxLines="2" does not always show ellipsis

To Reproduce

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="MultiLineTextTrimmingBug.MainWindow"
        Title="MultiLineTextTrimmingBug">
     <TextBlock Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
                TextWrapping="Wrap" 
                TextTrimming="CharacterEllipsis"
                MaxLines="2" />
</Window>

Expected behavior

TextBlock TextTrimming=CharacterEllipsis with TextWrapping=Wrap show ellipsis when needed

Avalonia version

11.1.5, 11.2.2

OS

Windows, macOS

Additional context

image

@wieslawsoltes
Copy link
Collaborator Author

In WPF there is no MaxLines but tested with LineHeight/MaxHeight and it works correctly:


<TextBlock Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
       
    TextWrapping="Wrap" 
         
    TextTrimming="CharacterEllipsis"
           
    LineHeight="24"
      
    MaxHeight="48" />

<!-- MaxLines="2" is done using LineHeight/MaxHeight -->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant