Example #1
0
        public void Template_Should_Be_Instantated()
        {
            var target = new TestTemplatedControl
            {
                Template = new FuncControlTemplate(_ =>
                {
                    return(new StackPanel
                    {
                        Children = new Controls
                        {
                            new TextBlock
                            {
                            }
                        }
                    });
                }),
            };

            target.ApplyTemplate();

            var child = target.GetVisualChildren().Single();

            Assert.IsType <StackPanel>(child);
            child = child.VisualChildren.Single();
            Assert.IsType <TextBlock>(child);
        }
        public void Template_Should_Be_Instantated()
        {
            var target = new TestTemplatedControl
            {
                Template = new ControlTemplate(_ =>
                {
                    return new StackPanel
                    {
                        Children = new Controls
                        {
                            new TextBlock
                            {
                            }
                        }
                    };
                }),
            };

            target.ApplyTemplate();

            var child = target.GetVisualChildren().Single();
            Assert.IsType<StackPanel>(child);
            child = child.VisualChildren.Single();
            Assert.IsType<TextBlock>(child);
        }