public void PeekProperties() { ContentControlPoker cc = new ContentControlPoker(); Assert.IsNotNull(cc.DefaultStyleKey_, "DefaultStyleKey"); Assert.AreEqual(typeof(ContentControl), cc.DefaultStyleKey_, "DefaultStyleKey/Type"); }
public void ChangingContentInvalidatesMeasure() { var p = new ContentControlPoker(); p.Measure(new Size(50, 50)); Assert.IsTrue(p.Measured, "#1"); Assert.VisualChildren(p, "#2"); p.Measured = false; p.Content = "a"; p.Measure(new Size(50, 50)); Assert.IsTrue(p.Measured, "#3"); Assert.VisualChildren(p, "#4", new VisualNode <Grid> ("#a", new VisualNode <TextBlock> ("#b") ) ); p.Measured = false; p.Content = "b"; p.Measure(new Size(50, 50)); Assert.IsTrue(p.Measured, "#5"); Assert.VisualChildren(p, "#6", new VisualNode <Grid> ("#a", new VisualNode <TextBlock> ("#b") ) ); }
public void Content() { ContentControlPoker cc = new ContentControlPoker(); cc.Content = cc; Assert.IsNull(cc.OldContent, "OldContent"); Assert.IsNotNull(cc.NewContent, "NewContent"); Assert.AreSame(cc, cc.NewContent, "OldContent/NewContent"); }
public void ContentTemplate() { ContentControlPoker cc = new ContentControlPoker(); // Note: OnContentTemplateChanged was "removed" in SL2 final cc.ContentTemplate = new DataTemplate(); // and not merged (as expected) with OnContentChanged Assert.IsNull(cc.OldContent, "ContentTemplate/OldContent"); Assert.IsNull(cc.NewContent, "ContentTemplate/NewContent"); }
public void ContentControlOldNewContent() { ContentControlPoker cp = new ContentControlPoker(); ConcreteFrameworkElement cf1 = new ConcreteFrameworkElement(); ConcreteFrameworkElement cf2 = new ConcreteFrameworkElement(); cp.Content = cf1; cp.getParents = true; cp.Content = cf2; Assert.IsNull(cp.oldParent, "1"); Assert.AreEqual(cp, cp.newParent, "2"); }
public void ContentControlOldNewContent () { ContentControlPoker cp = new ContentControlPoker (); ConcreteFrameworkElement cf1 = new ConcreteFrameworkElement (); ConcreteFrameworkElement cf2 = new ConcreteFrameworkElement (); cp.Content = cf1; cp.getParents = true; cp.Content = cf2; Assert.IsNull (cp.oldParent, "1"); Assert.AreEqual (cp, cp.newParent, "2"); }
public void PeekProperties () { ContentControlPoker cc = new ContentControlPoker (); Assert.IsNotNull (cc.DefaultStyleKey_, "DefaultStyleKey"); Assert.AreEqual (typeof (ContentControl), cc.DefaultStyleKey_, "DefaultStyleKey/Type"); }
public void ContentTemplate () { ContentControlPoker cc = new ContentControlPoker (); // Note: OnContentTemplateChanged was "removed" in SL2 final cc.ContentTemplate = new DataTemplate (); // and not merged (as expected) with OnContentChanged Assert.IsNull (cc.OldContent, "ContentTemplate/OldContent"); Assert.IsNull (cc.NewContent, "ContentTemplate/NewContent"); }
public void Content () { ContentControlPoker cc = new ContentControlPoker (); cc.Content = cc; Assert.IsNull (cc.OldContent, "OldContent"); Assert.IsNotNull (cc.NewContent, "NewContent"); Assert.AreSame (cc, cc.NewContent, "OldContent/NewContent"); }
public void ChangingContentInvalidatesMeasure () { var p = new ContentControlPoker (); p.Measure (new Size (50, 50)); Assert.IsTrue (p.Measured, "#1"); Assert.VisualChildren (p, "#2"); p.Measured = false; p.Content = "a"; p.Measure (new Size (50, 50)); Assert.IsTrue (p.Measured, "#3"); Assert.VisualChildren (p, "#4", new VisualNode<Grid> ("#a", new VisualNode<TextBlock> ("#b") ) ); p.Measured = false; p.Content = "b"; p.Measure (new Size (50, 50)); Assert.IsTrue (p.Measured, "#5"); Assert.VisualChildren (p, "#6", new VisualNode<Grid> ("#a", new VisualNode<TextBlock> ("#b") ) ); }