Reputation: 2086
I’ve created a style for labels that adds a drop shadow:
<Style TargetType="Label" x:Key="BigLabel">
<Setter Property="FontSize" Value="35" />
<!-- some more... -->
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="0" Opacity="0.9" ShadowDepth="5" />
</Setter.Value>
</Setter>
</Style>
One of the labels for which I want to use the style is rotated. Now when I apply the style this way:
<Label Content="Awesome" Style="{StaticResource BigLabel}" >
<Label.LayoutTransform>
<RotateTransform Angle="-90" />
</Label.LayoutTransform>
</Label>
Then the result is that the drop shadow still goes into the same direction viewed from the label’s perspective (lower right), but into a different direction viewed from the user’s perspective (upper right). Now as there are multiple labels, some rotated and others not, I want the shadows to all go into the same direction viewed from the user’s perspective, lower right.
That means that either I have to set a different Direction
on the rotated labels, or to tell WPF to apply the style with the shadow after rotating. Now I’m wondering:
Is there a way to tell WPF to first rotate and then apply the style?
Upvotes: 0
Views: 141
Reputation: 17647
Try this, use the Direction attribute:
<Style TargetType="Label" x:Key="BigLabel">
<Setter Property="FontSize" Value="35" />
<!-- some more... -->
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="5" Opacity="0.92" ShadowDepth="3" Direction="225" />
</Setter.Value>
</Setter>
</Style>
Upvotes: 1