I've got WPF 4 app that has a number of UserControls that share styles in their child controls. So I'm creating a number of styles in my App.xaml as . For example:
<Style x:Key="ViewTitle" TargetType="{x:Type Border}">
<Setter Property="BorderBrush" Value="LightGray" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Top" />
</Style>
Then in my UserControls I use StaticResource to reference them, for example:
<Border Style="{StaticResource ViewTitle}">
<TextBlock Margin="6,3,4,5" FontSize="18" FontWeight="Bold" Foreground="White" HorizontalAlignment="Left" Text="Host Management" />
</Border>
This all works fine. The problem is the Visual Studio 2010 RC is putting a blue squiggly under the StaticResource reference and saying: The resource "ViewTitle" could not be resolved.
What's up with that? Is this a problem with Visual Studio or am I doing something wrong?
See Question&Answers more detail:os