コード例 #1
0
        public void Assigning_Control_To_Content_After_NonControl_Should_Clear_DataContext()
        {
            var target = new ContentPresenter();

            target.Content = "foo";
            target.UpdateChild();

            Assert.True(target.IsSet(Control.DataContextProperty));

            target.Content = new Border();
            target.UpdateChild();

            Assert.False(target.IsSet(Control.DataContextProperty));
        }
コード例 #2
0
        public void Assigning_Control_To_Content_Should_Not_Set_DataContext()
        {
            var target = new ContentPresenter
            {
                Content = new Border(),
            };

            Assert.False(target.IsSet(Control.DataContextProperty));
        }