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

HyperlinkButton for xAxis Labels

1 Answer 42 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Tyler
Top achievements
Rank 1
Tyler asked on 28 Sep 2011, 01:48 AM
How can I change my xAxis labels to HyperLinkButtons ?

1 Answer, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 30 Sep 2011, 01:31 PM
Hi Tyler,

You need to set custom AxisLabel2D style which can be applied implicitly to all labels on your axes. There add the HyperlinkButton:
<telerik:LabelFormatConverter x:Key="labelFormatConverter" />
<Style TargetType="telerik:AxisLabel2D">
    <Setter  Property="Foreground" Value="Red" />
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="VerticalAlignment" Value="Top" />
    <Setter Property="ItemLabelStyle">
        <Setter.Value>
            <Style TargetType="TextBlock">
                <Setter Property="TextAlignment" Value="Center" />
                <Setter Property="Padding" Value="1" />
            </Style>
        </Setter.Value>
    </Setter>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="telerik:AxisLabel2D">
                <telerik:LayoutTransformControl x:Name="PART_LayoutTransformControl"
                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}">
                    <telerik:LayoutTransformControl.Content>
                        <HyperlinkButton>
                            <TextBlock Style="{TemplateBinding ItemLabelStyle}"
                                    Text="{Binding Converter={StaticResource labelFormatConverter}}" />
                        </HyperlinkButton>
                    </telerik:LayoutTransformControl.Content>
                    <telerik:LayoutTransformControl.LayoutTransform>
                        <RotateTransform x:Name="PART_RotateTransform" />
                    </telerik:LayoutTransformControl.LayoutTransform>
                </telerik:LayoutTransformControl>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Best wishes,
Sia
the Telerik team

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

Tags
Chart
Asked by
Tyler
Top achievements
Rank 1
Answers by
Sia
Telerik team
Share this question
or