xandermonkey
xandermonkey

Reputation: 4412

LayoutTransform Custom Style wpf

I'm trying to set up a custom style to rotate a separator.

This code works, but is not custom style:

 <Separator>
    <Separator.LayoutTransform>
       <RotateTransform Angle="90" />
    </Separator.LayoutTransform>
 </Separator>

Here is what I have tried:

<Style x:Key="CustomStandaloneSeparatorStyle" TargetType="Separator">
            <Setter TargetName="LayoutTransformProperty" Property="RotateTransform.Angle" Value="{Binding ToolbarTrayElementRotation}" />
            <Setter Property="Margin" Value="2"/>
</Style>

The error message is: "LayoutTransformProperty is not recognized". However, it IS available as an option when tab completing that entry... Weird.

Upvotes: 2

Views: 4330

Answers (2)

mm8
mm8

Reputation: 169200

The property is called LayoutTransform:

<Style x:Key="CustomStandaloneSeparatorStyle" TargetType="Separator">
    <Setter Property="LayoutTransform">
        <Setter.Value>
            <RotateTransform Angle="{Binding ToolbarTrayElementRotation}" />
        </Setter.Value>
    </Setter>
    <Setter Property="Margin" Value="2"/>
</Style>

Upvotes: 1

Joe White
Joe White

Reputation: 97696

You should be setting the LayoutTransform property to an instance of RotateTransform:

<Style x:Key="CustomStandaloneSeparatorStyle" TargetType="Separator">
    <Setter Property="LayoutTransform">
        <Setter.Value>
            <RotateTransform Angle="90" />
        </Setter.Value>
    </Setter>
</Style>

Upvotes: 5

Related Questions