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

ToolTip cuts off text if font size is changed with styles #17862

Open
Angelore opened this issue Jan 1, 2025 · 5 comments
Open

ToolTip cuts off text if font size is changed with styles #17862

Angelore opened this issue Jan 1, 2025 · 5 comments
Labels
bug help-wanted A contribution from the community would be most welcome.

Comments

@Angelore
Copy link

Angelore commented Jan 1, 2025

Describe the bug

If the font size for TextBlock is changed in the parent container, ToolTip cuts off the last word of the string.
image

The issue goes away if the string is changed in very minor ways, such as adding spaces or removing a colon:
image

To Reproduce

Set the font size to 16 and create a tooltip with the following text: Injectable: Monster in the Drain

public string OriginNameFormatted => "Injectable: Monster in the Drain";
  <Grid.Styles>
    <Style Selector="TextBlock">
      <Setter Property="FontSize" Value="16" />
    </Style>
  </Grid.Styles>
  <Panel VerticalAlignment="Center" HorizontalAlignment="Center">
    <PathIcon Data="{StaticResource Icon}" ToolTip.Tip="{Binding OriginNameFormatted}"/>
  </Panel>
</Grid>

ToolTipBugSample.zip

Expected behavior

I expect the ToolTip to adapt to FontSize changes, and either display the full string, or to wrap it.

Avalonia version

11.2.3

OS

Windows

Additional context

No response

@Angelore Angelore added the bug label Jan 1, 2025
@Angelore
Copy link
Author

Angelore commented Jan 1, 2025

I have tried targeting tooltip directly, and the result is the same.

<Grid>
  <Grid.Styles>
    <Style Selector="ToolTip /template/ ContentPresenter#PART_ContentPresenter">
      <Setter Property="FontSize" Value="16" />
    </Style>
  </Grid.Styles>
  <Panel VerticalAlignment="Center" HorizontalAlignment="Center">
    <PathIcon Data="{StaticResource Icon}" ToolTip.Tip="{Binding OriginNameFormatted}"/>
  </Panel>
</Grid>

@maxkatz6
Copy link
Member

maxkatz6 commented Jan 2, 2025

Since ToolTip default still is limited in width, to avoid extra-long tooltips, it should wrap.

@maxkatz6 maxkatz6 added the help-wanted A contribution from the community would be most welcome. label Jan 2, 2025
@robloo
Copy link
Contributor

robloo commented Jan 2, 2025

Note that there has been a text measurement issue since the 11.0 last previews that causes this same issue in appearance. It's probably the same overall.

In that issue color name tooltips in the ColorPicker are cut off in exactly the same way. It's always been reproducible with the ControlCatalog.

If it isn't an issue with text measurement / DPI / Display Scaling, it may be another popup lifecycle issue. I have long thought styles aren't evaluated correctly when popups are opened and there are other open issues for that.

I don't think this is a beginner issue to fix.

Edit: If it's a Popup style application issue here is where it was last discussed on my end: #14145 (comment)

@timunie
Copy link
Contributor

timunie commented Jan 2, 2025

#17875 (comment) could you give that PR a try? I know it's focused on Runs but maybe it helps anyways?

@Angelore
Copy link
Author

Angelore commented Jan 4, 2025

Looks like it was tested by a gentleman in that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help-wanted A contribution from the community would be most welcome.
Projects
None yet
Development

No branches or pull requests

4 participants