diff options
Diffstat (limited to 'Xamarin.Forms.Xaml/ApplyPropertiesVisitor.cs')
-rw-r--r-- | Xamarin.Forms.Xaml/ApplyPropertiesVisitor.cs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Xamarin.Forms.Xaml/ApplyPropertiesVisitor.cs b/Xamarin.Forms.Xaml/ApplyPropertiesVisitor.cs index 108d707e..327a4122 100644 --- a/Xamarin.Forms.Xaml/ApplyPropertiesVisitor.cs +++ b/Xamarin.Forms.Xaml/ApplyPropertiesVisitor.cs @@ -433,14 +433,16 @@ namespace Xamarin.Forms.Xaml ((IDataTemplate)dt).LoadTemplate = () => { #pragma warning restore 0612 + var cnode = node.Clone(); var context = new HydratationContext { ParentContext = Context, RootElement = Context.RootElement }; - node.Accept(new ExpandMarkupsVisitor(context), null); - node.Accept(new NamescopingVisitor(context), null); - node.Accept(new CreateValuesVisitor(context), null); - node.Accept(new RegisterXNamesVisitor(context), null); - node.Accept(new FillResourceDictionariesVisitor(context), null); - node.Accept(new ApplyPropertiesVisitor(context, true), null); - return context.Values[node]; + cnode.Accept(new XamlNodeVisitor((n, parent) => n.Parent = parent), node.Parent); //set parents for {StaticResource} + cnode.Accept(new ExpandMarkupsVisitor(context), null); + cnode.Accept(new NamescopingVisitor(context), null); + cnode.Accept(new CreateValuesVisitor(context), null); + cnode.Accept(new RegisterXNamesVisitor(context), null); + cnode.Accept(new FillResourceDictionariesVisitor(context), null); + cnode.Accept(new ApplyPropertiesVisitor(context, true), null); + return context.Values[cnode]; }; } } |