I'm trying to unit test a user interface using the Silverlight 4 Toolkit.
When I attempt to instantiate the UserControl, it's throwing an exception because in the XAML of the UserControl it's using a Style defined App.xaml.
Is there a way to load the resource somehow before I instantiate the UserControl? Am I going about this the wrong way?
Here's the unit test code:
[TestMethod]
public void ExerciseTimePeriodUserInterface()
{
CustomUserControls.TimePeriodFilter timePeriodFilter = new CustomUserControls.TimePeriodFilter();
}
Here's the reference to the style in the UserControl:
<Border Style="{StaticResource FilterBorderWrapper}">
And lastly, here's the style defined in the App.xaml:
<Style TargetType="Border" x:Key="FilterBorderWrapper">
<Setter Property="Background" Value="#F1F5FB" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="#CBD9E9" />
<Setter Property="CornerRadius" Value="2" />
<Setter Property="Margin" Value="2" />
</Style>