diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2016-12-06 08:56:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-06 08:56:08 +0100 |
commit | ff1bf0b5ef5ceb9b5b4b65809f91c4c608d26fff (patch) | |
tree | 3188b6fd66414745563c1d99af56dd4e6cdd0c79 /Xamarin.Forms.Core/ResourcesExtensions.cs | |
parent | c612398bd26bdb0e0d92c7edf5bb102657868431 (diff) | |
download | xamarin-forms-ff1bf0b5ef5ceb9b5b4b65809f91c4c608d26fff.tar.gz xamarin-forms-ff1bf0b5ef5ceb9b5b4b65809f91c4c608d26fff.tar.bz2 xamarin-forms-ff1bf0b5ef5ceb9b5b4b65809f91c4c608d26fff.zip |
ResourceDictionary fixes (#536)
* [C] avoid leaking RDs, remove reflection call, validate arguments
* [C,Xaml] The only way to get merged values are internal
Diffstat (limited to 'Xamarin.Forms.Core/ResourcesExtensions.cs')
-rw-r--r-- | Xamarin.Forms.Core/ResourcesExtensions.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Xamarin.Forms.Core/ResourcesExtensions.cs b/Xamarin.Forms.Core/ResourcesExtensions.cs index a75e264a..8930abf2 100644 --- a/Xamarin.Forms.Core/ResourcesExtensions.cs +++ b/Xamarin.Forms.Core/ResourcesExtensions.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace Xamarin.Forms { - internal static class ResourcesExtensions + static class ResourcesExtensions { public static IEnumerable<KeyValuePair<string, object>> GetMergedResources(this IElement element) { @@ -11,10 +11,10 @@ namespace Xamarin.Forms while (element != null) { var ve = element as IResourcesProvider; - if (ve != null && ve.Resources != null && ve.Resources.Count != 0) + if (ve != null && ve.Resources != null) { - resources = resources ?? new Dictionary<string, object>(ve.Resources.Count); - foreach (KeyValuePair<string, object> res in ve.Resources) + resources = resources ?? new Dictionary<string, object>(); + foreach (KeyValuePair<string, object> res in ve.Resources.MergedResources) if (!resources.ContainsKey(res.Key)) resources.Add(res.Key, res.Value); else if (res.Key.StartsWith(Style.StyleClassPrefix, StringComparison.Ordinal)) |