This is a migrated thread and some comments may be shown as answers.

Incorrect documentation for theme switching

0 Answers 36 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kristoffer
Top achievements
Rank 1
Kristoffer asked on 11 Dec 2012, 12:48 PM
Your documentation is prone to a known WPF bug:
http://www.telerik.com/help/wpf/styling-apperance-themes-runtime.html

In my WPF 4.0 project, your code makes all my controls disappear. Apparently, there is a known bug in the MergedDictionaries.Clear() method, as pointed out here:
http://social.msdn.microsoft.com/Forums/en/wpf/thread/dd061aa4-0151-4122-ab4d-25ae6b6e7c94

This did the trick for me:
// WORKAROUND: Application.Current.Resources.MergedDictionaries.Clear();
for (int i = Application.Current.Resources.MergedDictionaries.Count - 1; i >= 0; --i)
    Application.Current.Resources.MergedDictionaries.RemoveAt(i);

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Kristoffer
Top achievements
Rank 1
Share this question
or