I want to override the ContextMenu's style.
Here's my style:
<SolidColorBrush x:Key="WindowBackgroundBrush" Color="#E7E8EC" />
<SolidColorBrush x:Key="SolidBorderBrush" Color="#CCCEDB" />
<Color x:Key="DropShadowColor">#808080</Color>
<Style TargetType="{x:Type ContextMenu}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContextMenu}">
<Border Name="Border" Background="{StaticResource WindowBackgroundBrush}" BorderBrush="{StaticResource SolidBorderBrush}" BorderThickness="1" >
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
<Border.Effect>
<DropShadowEffect Color="{StaticResource DropShadowColor}" Opacity="0.60" ShadowDepth="4"/>
</Border.Effect>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
I dont know why, but the shadow is not working (I dont see the shadow).
How can I solve it?
of course you won't see the shadow, because it is applied to the top-most element in the visual tree. give some margin to your border and you will see the shadow effect.
Regards
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With