I am trying to use the unit test user interface using the Silverlight 4 Toolkit.
When I try to instantiate a UserControl, it throws an exception because the XAML UserControl uses the style defined by App.xaml.
Is there a way to load a resource somehow before I create an instance of UserControl? Am I going about it wrong?
Here's the unit test code:
[TestMethod]
public void ExerciseTimePeriodUserInterface()
{
CustomUserControls.TimePeriodFilter timePeriodFilter = new CustomUserControls.TimePeriodFilter();
}
Here is a link to the style in UserControl:
<Border Style="{StaticResource FilterBorderWrapper}">
And finally, here is the style defined in 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>
source
share