Exemplo n.º 1
0
        public static ControlTemplate ControlTemplate <TRootUI>(Type targetType, Action <Xaml.DependencyObject> build) where TRootUI : Xaml.UIElement, new()
        {
            var ui = new Xaml.Controls.ControlTemplate(() =>
            {
                var root = new TRootUI();
                buildingControlTemplate = true;
                try { build(root); } finally { buildingControlTemplate = false; }
                return(root);
            });

            return(CSharpMarkup.WinUI.ControlTemplate.StartChain(ui));
        }
Exemplo n.º 2
0
        public static ControlTemplate ControlTemplate <TRootUI>(Type targetType, Func <UIElement> build) where TRootUI : Controls.Panel, new()
        {
            var ui = new Xaml.Controls.ControlTemplate(() =>
            {
                var root = new Xaml.Controls.Grid();
                buildingControlTemplate = true;
                try { var child = build(); root.Children.Add(child.UI); } finally { buildingControlTemplate = false; }
                return(root);
            });

            return(CSharpMarkup.WinUI.ControlTemplate.StartChain(ui));
        }