dotnet / dotnet/wpf

Windows Close Button Mouse Hover Highlight is still enabled while mouse is away from WPF Window

Open
#7,573 3 comments 0 reactions 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

While using a Windows Close Button is still highlighted after the user moves their mouse in a fast motion, away from the WPF Window. (Template Code will be provided below)

### Reproduction Steps

1. Create a basic C# WPF .NET 6 Desktop Application
2. In the MainWindow create a (Code Below)
3. Run the application
4. Hover your mouse over the Close Button to see it highlight
5. From there, in a fast motion, move your mouse away from the MainWindow

### Expected behavior

Close Button will stop highlighting once your mouse leaves the button bounds

### Actual behavior

Close Button will continue to be highlighted until their mouse reaches the title bar

### Regression?

No, the bug wasn't noticed until now.

### Known Workarounds

There is no known workarounds.

### Impact

As per @champnic -> https://github.com/MicrosoftEdge/WebView2Feedback/issues/3159

It appears that the bug may be in the WPF WindowChrome implementation of the caption controls .

### Configuration

SDK: WebView2 1.0.1518.46
Runtime: WebView2.FixedVersionRuntime.109.0.1518.52.x64
Framework: WPF .NET 6.0
OS: Win10

**Note: as per @champnic this bug is not related to Webview2**

### Other information

### MainWindow Code

**MainWindow.xaml**
```





























```

**MainWindow.cs**
```
using System;
using System.Diagnostics;
using System.Windows;

namespace Webview_App
{
///
/// Interaction logic for MainWindow.xaml
///
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();

Dispatcher.BeginInvoke(new Action(() => InitializeWebView2Async()));
}

private async void InitializeWebView2Async()
{
try
{
await this.CustomWebView.EnsureCoreWebView2Async();
this.CustomWebView.CoreWebView2.Navigate("https://microsoft.com/");
}
catch (Exception ex)
{
Debug.WriteLine("failed to initialize webview");
}
}
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.