Created
August 17, 2010 21:05
-
-
Save jacksonh/532024 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestMethod] | |
[Asynchronous] | |
public void ChangeContentChangesTemplate () | |
{ | |
ContentControl c = (ContentControl) XamlReader.Load (@" | |
<ContentControl xmlns=""http://schemas.microsoft.com/client/2007"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""> | |
<ContentControl.Template> | |
<ControlTemplate> | |
<Grid> | |
<ContentPresenter /> | |
</Grid> | |
</ControlTemplate> | |
</ContentControl.Template> | |
</ContentControl> | |
"); | |
// Check what happens going from UIElement -> UIElement | |
c.Content = new Rectangle (); | |
c.ApplyTemplate (); | |
CreateAsyncTest (c, | |
() => Assert.VisualChildren (c, "#1", | |
new VisualNode<Grid> ("#a", | |
new VisualNode<ContentPresenter> ("#b", | |
new VisualNode<Rectangle> ("#c") | |
) | |
) | |
), | |
() => { | |
c.Content = new Rectangle (); | |
Assert.VisualChildren (c, "#3", | |
new VisualNode<Grid> ("#d", | |
new VisualNode<ContentPresenter> ("#e") | |
) | |
); | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment