I have a WPF application with Caliburn.Micro. I have a style defined in ResourceDictionary/Styles.xaml:
<Style x:Key="DisplayNameTextBlockStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="#FF414462" />
<Setter Property="Margin" Value="4,4,4,0" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="13.333" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
I am trying to apply it to my control like this:
<ScrollViewer HorizontalScrollBarVisibility="Auto">
<telerik:RadBusyIndicator IsBusy="{Binding IsBusy}">
<StackPanel x:Name="LayoutRoot">
<StackPanel Margin="0 0 0 0" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center"
Style="{StaticResource DisplayNameTextBlockStyle}"
Text="Data Entry" />
But because of some reason, on loading this view I am getting an exception:
Cannot find resource named ‘DisplayNameTextBlockStyle’. Resource names are case sensitive.”
Could you please help? Thanks.
Typically this happens because your resource dictionary hasn’t been loaded. You can manage this in many ways; the simplest is to include the following in your
app.xamlfile: