summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml/FillResourceDictionariesVisitor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Xaml/FillResourceDictionariesVisitor.cs')
-rw-r--r--Xamarin.Forms.Xaml/FillResourceDictionariesVisitor.cs29
1 files changed, 25 insertions, 4 deletions
diff --git a/Xamarin.Forms.Xaml/FillResourceDictionariesVisitor.cs b/Xamarin.Forms.Xaml/FillResourceDictionariesVisitor.cs
index 5eb47887..c140084a 100644
--- a/Xamarin.Forms.Xaml/FillResourceDictionariesVisitor.cs
+++ b/Xamarin.Forms.Xaml/FillResourceDictionariesVisitor.cs
@@ -37,6 +37,27 @@ namespace Xamarin.Forms.Xaml
public void Visit(ValueNode node, INode parentNode)
{
+ var parentElement = parentNode as IElementNode;
+ var value = Values [node];
+ var source = Values [parentNode];
+
+ XmlName propertyName;
+ if (ApplyPropertiesVisitor.TryGetPropertyName(node, parentNode, out propertyName)) {
+ if (parentElement.SkipProperties.Contains(propertyName))
+ return;
+ if (parentElement.SkipPrefix(node.NamespaceResolver.LookupPrefix(propertyName.NamespaceURI)))
+ return;
+ if (propertyName.NamespaceURI == "http://schemas.openxmlformats.org/markup-compatibility/2006" &&
+ propertyName.LocalName == "Ignorable") {
+ (parentNode.IgnorablePrefixes ?? (parentNode.IgnorablePrefixes = new List<string> ())).AddRange (
+ (value as string).Split (','));
+ return;
+ }
+ if (propertyName.LocalName != "MergedWith")
+ return;
+ ApplyPropertiesVisitor.SetPropertyValue(source, propertyName, value, Context.RootElement, node, Context, node);
+ }
+
}
public void Visit(MarkupNode node, INode parentNode)
@@ -56,10 +77,10 @@ namespace Xamarin.Forms.Xaml
//Set Resources in ResourcesDictionaries
if (IsCollectionItem(node, parentNode) && parentNode is IElementNode)
{
- if (typeof (IEnumerable).GetTypeInfo().IsAssignableFrom(Context.Types[parentElement].GetTypeInfo()))
+ if (typeof (IEnumerable).IsAssignableFrom(Context.Types[parentElement]))
{
var source = Values[parentNode];
- if (Context.Types[parentElement] == typeof (ResourceDictionary) && value is Style &&
+ if (typeof (ResourceDictionary).IsAssignableFrom(Context.Types[parentElement]) && value is Style &&
!node.Properties.ContainsKey(XmlName.xKey))
{
node.Accept(new ApplyPropertiesVisitor(Context), parentNode);
@@ -75,9 +96,9 @@ namespace Xamarin.Forms.Xaml
}
((ResourceDictionary)source).Add(value as Style);
}
- else if (Context.Types[parentElement] == typeof (ResourceDictionary) && !node.Properties.ContainsKey(XmlName.xKey))
+ else if (typeof (ResourceDictionary).IsAssignableFrom(Context.Types[parentElement]) && !node.Properties.ContainsKey(XmlName.xKey))
throw new XamlParseException("resources in ResourceDictionary require a x:Key attribute", node);
- else if (Context.Types[parentElement] == typeof (ResourceDictionary) && node.Properties.ContainsKey(XmlName.xKey))
+ else if (typeof (ResourceDictionary).IsAssignableFrom(Context.Types[parentElement]) && node.Properties.ContainsKey(XmlName.xKey))
{
node.Accept(new ApplyPropertiesVisitor(Context), parentNode);
if (markupExtension != null)