This is a migrated thread and some comments may be shown as answers.

Change color of axis labels and lines

3 Answers 186 Views
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 25 Jan 2012, 12:55 AM
Is it possible to change the color of the axis labels and the axis lines? I have a DateTimeContinuousAxis and a LinearAxis and I cant seem to change the colors from the default Black.


thanks

3 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 27 Jan 2012, 11:22 AM
Hi,

Please set the following style:
<Style x:Key="CustomAxis" TargetType="telerik:Axis">
    <Setter Property="LineStroke" Value="Red" />
    <Setter Property="LabelStyle">
        <Setter.Value>
            <Style TargetType="TextBlock">
                <Setter Property="Margin" Value="4"/>
                <Setter Property="Foreground" Value="Red" />
            </Style>
        </Setter.Value>
    </Setter>
    <Setter Property="MajorTickStyle">
        <Setter.Value>
            <Style TargetType="Rectangle">
                <Setter Property="Fill" Value="Red"/>
            </Style>
        </Setter.Value>
    </Setter>
</Style>

to the axes in your application.

All the best,
Sia
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Mario
Top achievements
Rank 1
answered on 29 Feb 2012, 05:51 PM
Hi, how could I change the color of an axis title? I guess it is using the TitleTemplate property, but I don't know how to define it.
0
Sia
Telerik team
answered on 02 Mar 2012, 03:31 PM
Hi Jorge,

Yes, the TitleTemplate can be used for such purpose through the same style.

Here it is:
<Style x:Key="CustomAxis" TargetType="telerik:Axis">
    <Setter Property="TitleTemplate">
        <Setter.Value>
            <DataTemplate>
                <TextBlock Text="{Binding}" Foreground="Orange" />
            </DataTemplate>
        </Setter.Value>
    </Setter>
</Style>

Greetings,
Sia
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Asked by
David
Top achievements
Rank 1
Answers by
Sia
Telerik team
Mario
Top achievements
Rank 1
Share this question
or