コード例 #1
0
        public void Control_Should_Not_Register_With_Template_NameScope()
        {
            var root = new TestTemplatedRoot
            {
                Content = new Border
                {
                    Name = "foo",
                }
            };

            root.ApplyTemplate();

            Assert.Null(NameScope.GetNameScope((StyledElement)root.Presenter).Find("foo"));
        }
コード例 #2
0
        public void Control_That_Is_NameScope_Should_Register_With_Parent_NameScope()
        {
            UserControl userControl;
            var         root = new TestTemplatedRoot
            {
                Content = userControl = new UserControl
                {
                    Name = "foo",
                }
            };

            root.ApplyTemplate();

            Assert.Same(userControl, root.FindControl <UserControl>("foo"));
            Assert.Same(userControl, userControl.FindControl <UserControl>("foo"));
        }