Skip to content

WPF ToolTip PlacementMode Mouse does not use scaled mouse cursor bounding box nor dpi scaling #6596

Open
@Algorithman

Description

@Algorithman
  • .NET Core Version: (e.g. 3.0 Preview1, or daily build number, use dotnet --info)
.NET SDK (reflecting any global.json):
 Version:   6.0.300
 Commit:    8473146e7d

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19044
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.300\

Host (useful for support):
  Version: 6.0.5
  Commit:  70ae3df4a6

.NET SDKs installed:
  5.0.408 [C:\Program Files\dotnet\sdk]
  6.0.300 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  • Windows version: (winver)
    Version 21H2 (OS Build 19044.1706)

  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes/No
    .NET Framework 4.8 does show a different behavior:
    image
    (This is without mouse cursor scaling on 150% dpi scaling)

  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? If yes, please file the issue via the instructions here.

  • Security issues and bugs should be reported privately, learn more via our responsible disclosure guidelines.

Problem description:
A tooltip with Placement set to PlacementMode.Mouse will appear below the mouse point.
So far so good.
But on high dpi displays with scaling > 1 it does not adhere to the actual mouse cursor bounding box.
image

Nor does it adhere to a scaled mouse cursor (can't show an image, since neither irfanview or hypersnap do use the scaled mouse cursor, you just have to try it for yourself)

Actual behavior:
image

Expected behavior:
Tooltip placement mode Mouse should adhere to dpi and mouse scaling to prevent overlapping and thus unreadable tooltip beginning

Minimal repro:

<Window x:Class="WpfApp1.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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Window.Resources>
        <Style TargetType="ToolTip" x:Key="ToolTipWrap">
            <Setter Property="Placement" Value="Mouse"/>
        </Style>
    </Window.Resources>
    <Grid>
        <TextBlock Text="TestText">
            <TextBlock.ToolTip>
                <ToolTip Content="TestText" Placement="Mouse"/>
            </TextBlock.ToolTip>
        </TextBlock>
    </Grid>
</Window>

Metadata

Metadata

Labels

InvestigateRequires further investigation by the WPF team.area-Tooltip

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions