I'm trying to add an effect to style in order to reuse it, but from some reason it doesnt work...
<Style x:Key="NumericTextBoxStyle" TargetType="{x:Type TextBox}">
<Style.Resources>
<TextBox.Effect x:Key="EffectStyle">
<DropShadowEffect BlurRadius="56"
Direction="392"
Color="#FF872E2E"
RenderingBias="Quality"/>
</TextBox.Effect>
</Style.Resources>
<Setter Property="Height" Value="25"/>
<Setter Property="Width" Value="120"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
but how do i add the style part ? (also how do i declare for the effect ?)
thanks
Try to add the Effect as a Setter instead
<Style x:Key="NumericTextBoxStyle" TargetType="{x:Type TextBox}">
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="56"
Direction="392"
Color="#FF872E2E"
RenderingBias="Quality"/>
</Setter.Value>
</Setter>
<Setter Property="Height" Value="25"/>
<Setter Property="Width" Value="120"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
Or if you want to have the Effect as a Resource in the Style you can do it like this
<Style x:Key="NumericTextBoxStyle" TargetType="{x:Type TextBox}">
<Style.Resources>
<DropShadowEffect x:Key="dropShadowEffect"
BlurRadius="56"
Direction="392"
Color="#FF872E2E"
RenderingBias="Quality"/>
</Style.Resources>
<Setter Property="Effect" Value="{StaticResource dropShadowEffect}"/>
<!--...-->
</Style>