Problem with whatControl = window.Get<?>()

Mar 14, 2008 at 4:43 PM
Hi,

I have a WPF window like this …

<Grid x:Name="LayoutRoot">
<Border x:Name="ActiveViewPlaceholder"/>
</Grid>

A control will be loaded dynamically inside that ActiveViewPlaceholder. I can’t figure out how to verify that a control was loaded into that Border element. Ideally I would like to get the Border and later verify that has something in it. In the worst case I could settle for verifying that a specific control like DefaultView was loaded. However I can’t figure out what control to get with window.Get<>();

Thank you
mike
Coordinator
Mar 22, 2008 at 6:51 PM
Sorry, somehow I completely missed this post.
Is it possible for you to send me some sample code?
Mar 23, 2008 at 12:03 AM
Edited Mar 23, 2008 at 12:04 AM
Don't worry its cool to get any help at any time ...

Here is the scenario I'm testing:

Given the Window

<Window Title="TestWindow">
<Grid x:Name="LayoutRoot">
<Border x:Name="ActiveViewPlaceholder"/>
</Grid>
</Window>

At some point a control will be loaded inside the ActiveViewPlaceholder so I would like to test that ...

TestMethod
public void TestWindow-has-an-ActiveView(){

var app = Application.Launch(appName);
var window = app.GetWindow("TestWindow", ...);

// don't know what type to Get<?>
var ActiveViewPlaceholder = window.Get<?>("ActiveViewPlaceholder");

// ActiveViewPlaceholder is a Border so ideally
Assert.IsNotNull(ActiveViewPlaceholder.Child);

app.Kill();
}

Thank you
Mike
Coordinator
Mar 31, 2008 at 7:17 AM
As of now you would have to know what is coming at the placeholder child and specify that type.
Also border is not supported yet in white. I would create an issue for it.