public static ItemsPanelTemplate ItemsPanelTemplate <TRootUI>(Action <Xaml.DependencyObject> build) where TRootUI : Xaml.UIElement, new() { #if WINUI // Note that we cannot pass markup objects to the build action here, because we get the ui type instance. var ui = (Xaml.Controls.ItemsPanelTemplate)CreateTemplate(nameof(Xaml.Controls.ItemsPanelTemplate), typeof(TRootUI), true, ConfigureRoot.CreateIdFor(build)); #else var ui = new Xaml.Controls.ItemsPanelTemplate(() => { var root = new TRootUI(); build(root); return(root); }); #endif return(CSharpMarkup.WinUI.ItemsPanelTemplate.StartChain(ui)); }
public static ItemsPanelTemplate ItemsPanelTemplate <TRootUI>(Func <UIElement> build) where TRootUI : Xaml.Controls.Panel, new() { #if WINUI var ui = (Xaml.Controls.ItemsPanelTemplate)CreateTemplate(nameof(Xaml.Controls.ItemsPanelTemplate), typeof(TRootUI), false, BuildChild.CreateIdFor(build)); #else var ui = new Xaml.Controls.ItemsPanelTemplate(() => { var root = new TRootUI(); var child = build(); root.Children.Add(child.UI); return(root); }); #endif return(CSharpMarkup.WinUI.ItemsPanelTemplate.StartChain(ui)); }