Devi
Devi

Reputation: 336

Y axis Header in Chart

I am creating a chart as a user control in WPF. For the Y axis header I had added a textbox. It is displayed in the vertical direction. User can edit the title. While clicking on the textbox, it should be rendered in horizontal direction over the chart plot area. After user entered the text it should be in the default vertical direction. How can I achieve this?

Upvotes: 0

Views: 197

Answers (1)

michele
michele

Reputation: 2091

You can rotate on focus styling your textboxes. Something like

<Style TargetType="{x:Type TextBox}">
                <Setter Property="RenderTransform">
                    <Setter.Value>
                        <RotateTransform Angle="-90"></RotateTransform>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <Trigger Property="IsFocused" Value="True">
                        <Setter Property="RenderTransform">
                            <Setter.Value>
                                <RotateTransform Angle="0"></RotateTransform>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </Style.Triggers>
            </Style>

Upvotes: 2

Related Questions