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

BUG: Flyouts not showing after WIN+L #364

Open
Royosef opened this issue Jun 25, 2021 · 5 comments
Open

BUG: Flyouts not showing after WIN+L #364

Royosef opened this issue Jun 25, 2021 · 5 comments

Comments

@Royosef
Copy link

Royosef commented Jun 25, 2021

I'm using ModernWpfUI in my WPF app and recently I've encountered some pretty weird bug:
if you open a secondary window context menus (and all other flyouts) stop appearing after WIN+L .

I reproduced the issue in the ModernWpf.SampleApp by viewing the ContentDialog page and
clicking Open a new window:

image

clicking Show content dialog in this window:

image

and right clicking some of the text boxes:

image

after locking the computer (WIN+L) and reopening it the context menu stops from showing on right click:

image

@baochenw
Copy link

baochenw commented Jun 26, 2021

I also experience this issue. And I found this issue goes away when disable hardware acceleration.

@Royosef
Copy link
Author

Royosef commented Jun 27, 2021

Unfortunately I don't have the option to disable it, is there any other solution for this? some change for the code?

@baochenw
Copy link

baochenw commented Jul 1, 2021

Disable Hardware rendering, using the DisableHWAcceleration registry value discussed in Disable Hardware Acceleration Option. This will affect all WPF applications on your machine; do this only as a way to test if your problem is related to graphics hardware or drivers. If that's the case, you can work around the problem by programmatically disabling hardware acceleration at a more granular level. This can be done on a per-window basis by using the HwndTarget.RenderMode property, or on a per-process basis by using the RenderOptions.ProcessRenderMode property.

https://docs.microsoft.com/en-us/troubleshoot/dotnet/framework/wpf-render-thread-failures#general-recommendations

@valves904
Copy link

valves904 commented Jul 19, 2021

Can confirm the following works to sidestep the issue:

<Window [...]
             Loaded="Window_Loaded"
             Unloaded="Window_Unloaded">

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    // Force software rendering on this subwindow
    RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
}

private void Window_Unloaded(object sender, RoutedEventArgs e)
{
    RenderOptions.ProcessRenderMode = RenderMode.Default;
}

Not sure why this bug only happens on secondary windows however ¯\_(ツ)_/¯

@milos12345
Copy link

I have found possible reason for issues related to ModernWPF breaking after Lock/Unlock of workstation (in my case is ContextMenu breaking):
Having SystemParameters.DropShadowKey on auto and enabled on system, or enabled will cause this, so I can consistently break it if I start program with
Application.Current.Resources[SystemParameters.DropShadowKey] = true;
but it will consistently work after Win+L if I explicitly set
Application.Current.Resources[SystemParameters.DropShadowKey] = false;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants