Skip to content

Fluent Theme: ToolTip inherits style from TextBlock #9973

Closed
@bent-rasmussen

Description

@bent-rasmussen

Description

In the new .NET 9 Fluent theme, setting setting e.g. font weight on a TextBlock will cause its tooltip to have the same style. This is of course undesirable. It could be that other controls are affected as well, I have only tested with TextBlock.

Reproduction Steps

  • Create a .NET 9 WPF application
  • Change the MainWindow.xaml like so:
<Window
    x:Class="ScrollViewerTextWrapping.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:ScrollViewerTextWrapping"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="MainWindow"
    Width="400"
    Height="200"
    ThemeMode="Light"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <Grid>

        <TextBlock
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            FontWeight="Bold"
            ToolTip="This is a tooltip">
            This is not a tooltip
        </TextBlock>

    </Grid>
</Window>

Expected behavior

ToolTip styling is independent of TextBlock.

Image

Actual behavior

ToolTip styling "inherits" from TextBlock.

Image

Regression?

Prior versions of .NET as well as .NET 9 when not using the Fluent theme does not exhibit this issue.

Known Workarounds

Introducing a nested Run element with the style, like so:

<TextBlock
    HorizontalAlignment="Center"
    VerticalAlignment="Center"
    ToolTip="This is a tooltip">
    <Run FontWeight="Bold">This is not a tooltip</Run>
</TextBlock>

Impact

Degrades UX of tooltips.

Configuration

Property Value
SDK .NET 9 RC2
OS Name Microsoft Windows 11 Pro
Version 10.0.22631 Build 22631
System SKU Surface_Pro_8_1983

Other information

No response

Metadata

Metadata

Assignees

Type

Projects

Status

☑ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions