summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-04-18 16:44:21 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-04-18 16:44:21 (GMT)
commitfc05a57e9dfa5b70e21b08f9c8f839b7986b4698 (patch)
tree87484d46ca24d00ca3c38d4c9b85c849d3298722 /Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs
parent9c005f30227eaf0d3aa7d253a7c3a9ea427c91c2 (diff)
downloadxamarin-forms-fc05a57e9dfa5b70e21b08f9c8f839b7986b4698.zip
xamarin-forms-fc05a57e9dfa5b70e21b08f9c8f839b7986b4698.tar.gz
xamarin-forms-fc05a57e9dfa5b70e21b08f9c8f839b7986b4698.tar.bz2
Make sure StaticResources can be looked up in ResourceDictionaries directly (#106)
Diffstat (limited to 'Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs')
-rw-r--r--Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs7
1 files changed, 3 insertions, 4 deletions
diff --git a/Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs b/Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs
index 4f1465d..cf672a3 100644
--- a/Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs
+++ b/Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs
@@ -27,12 +27,11 @@ namespace Xamarin.Forms.Xaml
foreach (var p in valueProvider.ParentObjects)
{
var ve = p as VisualElement;
- if (ve == null)
- continue;
- if (ve.Resources == null)
+ var resDict = ve?.Resources ?? p as ResourceDictionary;
+ if (resDict == null)
continue;
object res;
- if (ve.Resources.TryGetValue(Key, out res))
+ if (resDict.TryGetValue(Key, out res))
{
return ConvertCompiledOnPlatform(res);
}