|
In my resource file I have:
<!--*************************************************************************
* COLORS & BRUSHES
************************************************************************-->
<Color x:Key="TextForeColor">Black</Color>
<SolidColorBrush x:Key="TextForeColorBrush"
Color="{StaticResource TextForeColor}"/>
<!--*************************************************************************
* BASE STYLES
************************************************************************-->
<Style x:Key="BaseTextBlockStyle"
TargetType="TextBlock">
<Setter Property="FontSize" Value="12" />
<Setter Property="FontFamily" Value="Segoe UI" />
<Setter Property="Foreground" Value="{StaticResource TextForeColorBrush}"/>
<Setter Property="FontStyle" Value="Normal"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<Style x:Key="TextBlockStyle"
TargetType="TextBlock"
BasedOn="{StaticResource BaseTextBlockStyle}">
<Setter Property="Foreground" Value="{StaticResource DataEnteryTextBlockForeColorBrush}"/>
</Style>
<Style x:Ke
Then in a view I have:
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\Resources.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
and
<!--Job Header Area-->
<GroupBox Header=" Job Information "
Grid.Row="0"
BorderBrush="SteelBlue"
Background="#E2F4FF"
Foreground="SteelBlue"
Height="100"
Margin="5"
FontSize="14"
FontStyle="Italic"
FontWeight="Bold">
<Grid>
<!--Job Number-->
<TextBlock Text="Job #: "
Grid.Row="0"
Grid.Column="0"
Style="{StaticResource TextBlockStyle}"
Margin="5,2,2,5"/>
<TextBlock Text="2013-0001"
Grid.Row="0"
Grid.Column="1"
MinWidth="55"
Style="{StaticResource TextBlockDataDisplayStyle}"
Margin="5,2,2,5"/>
The style on the groupbox is being applied to the TextBlocks and TextBoxes.
The style, color, and brush names are all correct.
Anyone see what Im doing wrong?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
I'm still very much a novice at XAML, but what does this line refer to?
<Setter Property="Foreground" Value="{StaticResource DataEnteryTextBlockForeColorBrush}"/>
I could not see any definition of DataEnteryTextBlockForeColorBrush .
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
From my deep knowledge of all things xaml (insert sarcasm smiley): When you create a style.xaml file that contains the style for DataEnteryTextBlockForeColorBrush. you can reference it via the app.xaml (Silverlight) and it becomes a static resource available to all views. You can also create the style in the view's xaml as a resource (grid.resource/usercontrol.resouce etc) and it becomes a static resource usable by that view only.
Hang on you answer more of these than I do!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
As I said: "I'm still very much a novice at XAML". Pete O'Hanlon could answer this without drawing breath.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
In my project it's defined above the XAML I pasted. I didn't include it to save space
If it's not broken, fix it until it is
|
|
|
|