Hi I have a resource dictionary for style my controls which will be like that
<ImageSource x:Key="winBackground">..\Images\bluebg.jpg</ImageSource><SolidColorBrush x:Key="infoBox_brush" Color="#FFFDA204"></SolidColorBrush><SolidColorBrush x:Key="infoBox_brush1" Color="White"/><SolidColorBrush x:Key="infoBox_brush2" Color="Black"/><SolidColorBrush x:Key="infoBox_brush3" Color="#FFFF0000"/><LinearGradientBrush x:Key="popup_btn_bg" StartPoint="0,0" EndPoint="0,1"><GradientBrush.GradientStops><GradientStopCollection><GradientStop Color="Cyan" Offset="0" /><GradientStop Color="DarkBlue" Offset="1" /></GradientStopCollection></GradientBrush.GradientStops></LinearGradientBrush><Style TargetType="{x:Type TextBlock}"><Setter Property="Foreground" Value="{StaticResource infoBox_brush1}"/></Style><Style x:Key="sty3" TargetType="{x:Type myToolkit:DatePicker}"><Setter Property="Foreground" Value="{StaticResource infoBox_brush2}"/></Style><Style TargetType="{x:Type Button}"><!-- General for all buttons --><Setter Property="Foreground" Value="Azure" /><Setter Property="FontFamily" Value="Traditional Arabic" /><Setter Property="FontSize" Value="20" /><Setter Property="FontWeight" Value="Bold" /><Setter Property="MinWidth" Value="10"></Setter><Setter Property="MinHeight" Value="15"></Setter><Setter Property="Margin" Value="4,4,4,4"></Setter><Setter Property="VerticalAlignment" Value="Center"></Setter><Setter Property="Background"><Setter.Value><RadialGradientBrush><GradientStop Color="#145082" Offset="0" /><GradientStop Color="Black" Offset="1" /></RadialGradientBrush></Setter.Value></Setter><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type Button}"><Grid><Rectangle x:Name="GelBackground" Opacity="1" RadiusX="9" RadiusY="9" Fill="{TemplateBinding Background}"></Rectangle><Rectangle x:Name="GelShine" Margin="2,2,2,0" VerticalAlignment="Top" Stroke="Transparent" RadiusX="4" RadiusY="4" Opacity=".8" Height="15"><Rectangle.Fill><LinearGradientBrush StartPoint="0,0" EndPoint="0,1"><GradientStop Color="#ccffffff" Offset="0" /><GradientStop Color="Transparent" Offset="1" /></LinearGradientBrush></Rectangle.Fill></Rectangle><ContentPresenter Margin="10,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Center" /></Grid><ControlTemplate.Triggers><Trigger Property="IsMouseOver" Value="true"><Setter Property="Foreground" Value="White" /><Setter Property="FontSize" Value="12" /><Setter Property="Rectangle.Fill" TargetName="GelBackground"><Setter.Value><RadialGradientBrush><GradientBrush.GradientStops><GradientStopCollection><GradientStop Color="Tomato" Offset="0" /><GradientStop Color="Black" Offset="1" /></GradientStopCollection></GradientBrush.GradientStops></RadialGradientBrush></Setter.Value></Setter></Trigger><Trigger Property="IsPressed" Value="true"><Setter Property="Foreground" Value="Black" /><Setter Property="Fill" TargetName="GelBackground"><Setter.Value><RadialGradientBrush><GradientStop Color="#ffcc00" Offset="0" /><GradientStop Color="#cc9900" Offset="1" /></RadialGradientBrush></Setter.Value></Setter></Trigger><Trigger Property="IsEnabled" Value="false"><Setter Property="Foreground" Value="Black" /><Setter Property="Fill" TargetName="GelBackground"><Setter.Value><RadialGradientBrush><GradientStop Color="White" Offset="0" /><GradientStop Color="#333333" Offset=".4" /><GradientStop Color="#111111" Offset=".6" /><GradientStop Color="#000000" Offset=".7" /><GradientStop Color="#000000" Offset="1" /></RadialGradientBrush></Setter.Value></Setter></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style><Storyboard x:Key="sbdUserControlAnimation"><DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Width"><SplineDoubleKeyFrame KeyTime="00:00:00" Value="0" /><SplineDoubleKeyFrame KeyTime="00:00:01" Value="600" /><SplineDoubleKeyFrame KeyTime="00:00:03" Value="600" /></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Height" AccelerationRatio="1"><SplineDoubleKeyFrame KeyTime="00:00:00" Value="10" /><SplineDoubleKeyFrame KeyTime="00:00:01" Value="10" /><SplineDoubleKeyFrame KeyTime="00:00:03" Value="200" /></DoubleAnimationUsingKeyFrames></Storyboard>
and it must be apply for buttons and textblock and buttons, but when I add the style for DatePicker it doest't work and show font foregroun for days in its calendar white which is the style for textblocks which is that:
<Style TargetType="{x:Type TextBlock}"><Setter Property="Foreground" Value="{StaticResource infoBox_brush1}"/></Style>
instead of that:
<Style x:Key="sty3" TargetType="{x:Type myToolkit:DatePicker}"><Setter Property="Foreground" Value="{StaticResource infoBox_brush2}"/></Style>
I assign the style in XAML like that:
<myToolkit:DatePicker Grid.Column="1" Grid.Row="2" Name="clndrBirthdate" Height="25" Margin="4,4,169,2" Width="200" Style="{StaticResource sty3}" />
Can any one till me where is my error Please. I appreciated any help, thanks.