Axis Title Style.

2 posts, 0 answers
  1. Lee
    Lee avatar
    30 posts
    Member since:
    Apr 2014

    Posted 16 May 2014 Link to this post

    Hi.

    My ' MultiVerticalAxis' is setted <Setter Property="Stroke" Value="{Binding Converter={StaticResource seriesColorConverter}}"/>.

    In converter, 

    axis.Title = obj.Unit;
    axis.Maximum += 0.5;
    axis.Minimum += -0.5;
    axis.LineStroke = new SolidColorBrush(Colors.White);
    axis.Foreground = new SolidColorBrush(Colors.White);
    axis.FontSize = 11;

    In this picture, I want to rotate 'Title Font'

    What should I do??


  2. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 19 May 2014 Link to this post

    Hi Lee,

    In order to rotate the Title of your axis you can define a DataTemplate with a native TextBlock element and set it as a value of the TitleTemplate property of the axis.  Then apply RotateTransform on the TextBlock. Here is an example in code:
    <telerik:LinearAxis Title="Axis" >
        <telerik:LinearAxis.TitleTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding}" TextOptions.TextFormattingMode="Display">
                    <TextBlock.LayoutTransform>
                        <RotateTransform Angle="90" />
                    </TextBlock.LayoutTransform>
                </TextBlock>
            </DataTemplate>
        </telerik:LinearAxis.TitleTemplate>
    </telerik:LinearAxis>
    To set the template in code behind you can define it in your application resources and get it in code behind by its x:Key property.
    axis.TitleTemplate = this.Resources["myTitleTemplate"] as DataTemplate;

    Regards,
    Martin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top