From 775df09a3e45e90128f9047e8618461d4c4411a0 Mon Sep 17 00:00:00 2001 From: Stephane Delcroix Date: Mon, 15 Aug 2016 22:06:11 +0200 Subject: [Xaml] x:Static in x:Arguments (#288) * [Xaml] Support x:Static as x:Arguments * [XamlC] allow x:Static in x:Arguments * fix typo, remove commented code --- Xamarin.Forms.Xaml/CreateValuesVisitor.cs | 6 +++--- Xamarin.Forms.Xaml/ExpandMarkupsVisitor.cs | 10 +++++++++- Xamarin.Forms.Xaml/XamlParser.cs | 3 +++ 3 files changed, 15 insertions(+), 4 deletions(-) (limited to 'Xamarin.Forms.Xaml') diff --git a/Xamarin.Forms.Xaml/CreateValuesVisitor.cs b/Xamarin.Forms.Xaml/CreateValuesVisitor.cs index e52ae594..014d82c2 100644 --- a/Xamarin.Forms.Xaml/CreateValuesVisitor.cs +++ b/Xamarin.Forms.Xaml/CreateValuesVisitor.cs @@ -124,8 +124,8 @@ namespace Xamarin.Forms.Xaml Values[node] = value; - var typeExtension = value as TypeExtension; - if (typeExtension != null) + var markup = value as IMarkupExtension; + if (markup != null && (value is TypeExtension || value is StaticExtension)) { var serviceProvider = new XamlServiceProvider(node, Context); @@ -135,7 +135,7 @@ namespace Xamarin.Forms.Xaml foreach (var cnode in node.CollectionItems) cnode.Accept(visitor, node); - value = typeExtension.ProvideValue(serviceProvider); + value = markup.ProvideValue(serviceProvider); node.Properties.Clear(); node.CollectionItems.Clear(); diff --git a/Xamarin.Forms.Xaml/ExpandMarkupsVisitor.cs b/Xamarin.Forms.Xaml/ExpandMarkupsVisitor.cs index 0d5e9ee6..36e8fc17 100644 --- a/Xamarin.Forms.Xaml/ExpandMarkupsVisitor.cs +++ b/Xamarin.Forms.Xaml/ExpandMarkupsVisitor.cs @@ -12,6 +12,14 @@ namespace Xamarin.Forms.Xaml Context = context; } + public static readonly IList Skips = new List + { + XmlName.xKey, + XmlName.xTypeArguments, + XmlName.xFactoryMethod, + XmlName.xName + }; + Dictionary Values { get { return Context.Values; } @@ -44,7 +52,7 @@ namespace Xamarin.Forms.Xaml XmlName propertyName; if (!ApplyPropertiesVisitor.TryGetPropertyName(markupnode, parentNode, out propertyName)) return; - if (ApplyPropertiesVisitor.Skips.Contains(propertyName)) + if (Skips.Contains(propertyName)) return; if (parentElement.SkipProperties.Contains(propertyName)) return; diff --git a/Xamarin.Forms.Xaml/XamlParser.cs b/Xamarin.Forms.Xaml/XamlParser.cs index 730c1624..7dd79d77 100644 --- a/Xamarin.Forms.Xaml/XamlParser.cs +++ b/Xamarin.Forms.Xaml/XamlParser.cs @@ -223,6 +223,9 @@ namespace Xamarin.Forms.Xaml case "x:FactoryMethod": propertyName = XmlName.xFactoryMethod; break; + case "x:Arguments": + propertyName = XmlName.xArguments; + break; default: Debug.WriteLine("Unhandled {0}", reader.Name); continue; -- cgit v1.2.3