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

fix #923 #932

Merged
merged 1 commit into from
Jan 14, 2014
Merged

fix #923 #932

merged 1 commit into from
Jan 14, 2014

Conversation

remcoros
Copy link
Contributor

No description provided.

@AzureKitsune
Copy link
Member

There was a reason for that code being there. I just can't remember why.

cc @punker76

@remcoros
Copy link
Contributor Author

I did a little bit of research.

If you look at the source of SystemResources.cs in .Net (http://www.dotnetframework.org/default.aspx/Dotnetfx_Win7_3@5@1/Dotnetfx_Win7_3@5@1/3@5@1/DEVDIV/depot/DevDiv/releases/Orcas/NetFXw7/wpf/src/Framework/System/Windows/SystemResources@cs/5/SystemResources@cs)

Line 1056 ( case NativeMethods.WM_THEMECHANGED:)

the order of invalidation is
SystemColors.InvalidateCache();
SystemParameters.InvalidateCache();
OnThemeChanged();
InvalidateResources(false)

The same as the work-around in ThemeManager.

The reason is probably (as stated in the comments), that system colors weren't changing and need to be invalidated.

BUT, As you can read on that SO question (and issue #923) this causes some issues with Measurement / weird double click behavior and something with MediaElement (I don't know what though).

Trough trial and error, I found out that if we leave everything as is, except for SystemParameters.InvalidateCache(). The colors are changing and the weird measure/click behavior is fixed.

From what I can see in my own app, everything seems to work now and no weird behavior is observed.

edit: Also, from what I can read 'SystemParameters' has mostly todo with sizes (height/width etc). (http://msdn.microsoft.com/en-us/library/system.windows.systemparameters(v=vs.110).aspx)

As ThemeManager is about colors and not sizing, I think it is safe to skip this call.

@punker76
Copy link
Member

the demo works, so we can merge this

punker76 added a commit that referenced this pull request Jan 14, 2014
@punker76 punker76 merged commit 656f940 into MahApps:master Jan 14, 2014
@AzureKitsune AzureKitsune mentioned this pull request Jan 14, 2014
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants