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

Maximized RibbonWindow state error after long IO operation. #159

Closed
llinyu opened this issue Aug 25, 2015 · 5 comments
Closed

Maximized RibbonWindow state error after long IO operation. #159

llinyu opened this issue Aug 25, 2015 · 5 comments
Assignees
Milestone

Comments

@llinyu
Copy link

llinyu commented Aug 25, 2015

When RibbonWindow is in maximized state, if the RibbonWindow is blocked by a long IO operation, the
maximized RibbonWindow state goes into error after IO completion.

image

@llinyu
Copy link
Author

llinyu commented Aug 25, 2015

You can check this test.
https://github.com/llinyu/RibbonTest/tree/master/RibbonTest/MaxStateTest

Thank you!

@chdft
Copy link

chdft commented Aug 25, 2015

Your problem seems to be the same as in #80. As far as I know the only known workaround is to not do heavy work on the UI thread.

@chdft
Copy link

chdft commented Aug 25, 2015

There seems to be another workaround: The window is rendered correctly again, if you set the WindowsState property of the Window to maximized again, after you have finished your long running operation on the UI thread.
Therefore you can work around the problem by executing the following after the long running code (in your example the for loop):

if (WindowState == System.Windows.WindowState.Maximized)
{
    WindowState = System.Windows.WindowState.Normal;
    WindowState = System.Windows.WindowState.Maximized;
}

I've tested this on Windows 7 with .Net 4.5.1 and it worked fine, but I recommend to outsource long running operations into background threads anyway. That way your UI doesn't lock up in the first place and users don't think your application has crashed.

@batzen
Copy link
Member

batzen commented Aug 25, 2015

It not always possible to use background threads.
Will have a look at this and at #80 because it recently started to affect my employers application...

@batzen batzen added this to the Next milestone Aug 25, 2015
@batzen batzen self-assigned this Aug 25, 2015
@batzen batzen closed this as completed in 76077ae Aug 25, 2015
@llinyu
Copy link
Author

llinyu commented Aug 26, 2015

Yes, heavy work in background thread is a good idea.

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

3 participants