static void Build(Xaml.DependencyObject target, string id = null, Xaml.UIElement templatedParent = null) { id ??= GetId(target); templatedParent ??= GetTemplatedParent(target); if (id is null || templatedParent is null) { return; } DependencyObjectExtensions.TemplatedParent = templatedParent; try { ConfigureRoot.Delegates[id](target); } // Any template bindings are created here, using the TemplatedParent for source finally { DependencyObjectExtensions.TemplatedParent = null; } }
static void Build(Xaml.Controls.Panel panel, string id = null, Xaml.UIElement templatedParent = null) { id ??= GetId(panel); templatedParent ??= GetTemplatedParent(panel); if (id is null || templatedParent is null) { return; } panel.Children.Clear(); DependencyObjectExtensions.TemplatedParent = templatedParent; try { panel.Children.Add(BuildChild.Delegates[id]().UI); } // Any template bindings are created here, using the TemplatedParent for source finally { DependencyObjectExtensions.TemplatedParent = null; } }
public static void SetTemplatedParent(Xaml.Controls.Panel panel, Xaml.UIElement parent) => panel.SetValue(TemplatedParentProperty, parent);
public static void SetTemplatedParent(Xaml.DependencyObject target, Xaml.UIElement parent) => target.SetValue(TemplatedParentProperty, parent);