question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Window content remains highlighted after mouse leaves window

See original GitHub issue

Describe the bug When opened as a modal window/dialog, the “elements” and contents of a MetroWindow keep their highlighted mouseover appearance when the mouse cursor leaves the window. This happens only if the mouse cursor “lands” on an other application window in the background, but not if the new destination is unoccupied (see attached animations for more clarity)!

I first noticed this with the regular window minimize/maximize/close buttons - but I can observe the same behavior with a regular button within the window content area (the margin to the window border needs to be reasonably small and you have to move the mouse cursor a little bit speedy), so I dare to guess that it happens with any kind of controls.

The problem only appears if the window is opened as a dialog (Window.ShowDialog()), but not if opened as a regular window (Window.Show())

To Reproduce Steps to reproduce the behavior:

  1. Implement two regular MetroWindows (let’s name them “MainWindow” and “Window1”)
  2. Add a Button to the main window and open Window1 as a modal window/dialog on the Click event of the button:
private void Button_Click(object sender, RoutedEventArgs e)
{
    Window1 window1 = new Window1();
    window1.Owner = this;
    window1.ShowDialog();
}
  1. Run the code and click the button on the main window.
  2. Move and resize Window1 so that it overlaps the main window.
  3. Hover the mouse over the close button of Window1 and observe its highlighted appearance.
  4. Quickly move the mouse cursor off the close button and onto the main window in the background.
  5. The close button of Window1 remains highlighted until the mouse cursor enters Window1 again (not necessarily via its close button, just anywhere)

Expected behavior All window elements and contents return to their regular, non-highlighted appearance after the mouse cursor has left the window.

Screenshots

  • Moving mouse to unoccupied area: No issue

MahAppsMetroDialogIssue01

  • Moving mouse to area occupied by other application window: Unexpected behavior

MahAppsMetroDialogIssue02 MahAppsMetroDialogIssue03

Environment(please complete the following information):

  • MahApps.Metro version v1.6.5
  • OS: Win10
  • Visual Studio 2017 15.9.11
  • .NET Framework 4.6.1

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
HengWhcommented, Oct 12, 2021

I have a similar problem. And I found that if I didn’t set the “GlowBrush” of the main window, everything would be ok. The GlowBrush is from ControlzEx.

I haven’t found a solution yet. I hope I can provide you with ideas. Problem will occur in MahApp version is 2.0+

0reactions
ravigneauxxcommented, Nov 4, 2019

@punker76 Thanks for pointing out that the issue also happens without MahApps.Metro! A two-minute Google search (facepalm) revealed this is a known issue with borderless windows (which, I believe, MahApps.Metro.MetroWindow is…)

Have a look here!

Maybe this solution can be incorporated into a future release of MahApps.Metro? 🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

Screen leaves black boxes on desktop after I drag cursor to ...
Go to Control Panel>System>Advanced system settings>Performance and in the Visual settings select "show windows contents while dragging". Save ...
Read more >
Taskbar icon stays highlighted : r/Windows10
Taskbar icon stays highlighted · Open up task manager · Under Processes, sort by name · In windows processes at the bottom of...
Read more >
Mouse is highlighting everything when I click
If your mouse is highlighting everything when you click, your mouse driver might be corrupted or Sticky keys are turned on. Try these...
Read more >
WPF Window MouseLeave event not firing when cursor ...
If the cursor leaves by one of the edges highlighted in red the `MouseLeave event is fired and the window closes. enter image...
Read more >
How to Fix Your Mouse Highlighting Everything When ...
Ensure your view mode is set to “Large icons,” then click on the “Mouse” menu. A new pop-up window should appear on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found