From c0c244a45d2db9314e048066b99ce0df6947410b Mon Sep 17 00:00:00 2001 From: Bastian Schmidt Date: Sun, 11 Aug 2019 16:43:33 +0200 Subject: [PATCH] Improve check for RD "equality" Only check RDs that have keys and only if first RD has at least as many keys as second --- src/MahApps.Metro/ThemeManager/ThemeManager.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/MahApps.Metro/ThemeManager/ThemeManager.cs b/src/MahApps.Metro/ThemeManager/ThemeManager.cs index 8aaa5c6d16..913cae0845 100644 --- a/src/MahApps.Metro/ThemeManager/ThemeManager.cs +++ b/src/MahApps.Metro/ThemeManager/ThemeManager.cs @@ -913,8 +913,13 @@ private static bool AreResourceDictionarySourcesEqual(ResourceDictionary first, return false; } - if (first.Source.IsNull() + // If RD does not have a source, but both have keys and the first one has at least as many keys as the second, + // then compares their values. + if ((first.Source.IsNull() || second.Source.IsNull()) + && first.Keys.Count > 0 + && second.Keys.Count > 0 + && first.Keys.Count >= second.Keys.Count) { try {