Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1415
Override RadialPieSeries LabelSettings
posted

How can I override the AxisLabel Foreground setting within my own App.xaml resource dictionary?

I've tried this but does not work

<Style TargetType="ig:NumericAngleAxis" >
                <Setter Property="LabelSettings">
                    <Setter.Value>
                        <ig:AxisLabelSettings Foreground="Blue" FontSize="20"/>
                    </Setter.Value>
                </Setter>
            </Style>

Parents
No Data
Reply
  • 1500
    Verified Answer
    Offline posted

    Hello,

    The easiest way to change the color of the label would be to set it in the LabelSettings of the axis.

    <ig:NumericYAxis x:Name="yAxis" >
                <ig:NumericYAxis.LabelSettings>
                    <ig:AxisLabelSettings Foreground="Red"/>
                </ig:NumericYAxis.LabelSettings>

    In case you would like to have this styled, I can suggest two options:

    1. Re-templating the Label. The label text is held by a textblock which can be styled. 

    <Style TargetType="{x:Type TextBlock}" x:Key="foreColorBlock">
                    <Setter Property="Foreground" Value="Orange"/>
                </Style>
                
                
                <ig:CategoryXAxis x:Name="xmCategoryXAxis"
                              ItemsSource="{StaticResource CategoryData1}">
                        <ig:CategoryXAxis.Label>
                            <DataTemplate>
                                <TextBlock Style="{StaticResource foreColorBlock}" Text="{Binding Item.Category}"/>
                            </DataTemplate>
                        </ig:CategoryXAxis.Label>

    More on Axis Label templates can be read on our website here.

    2. Define a brush resource and use it as Foreground Color:

    <SolidColorBrush x:Key="foregroundBrush" Color="{DynamicResource ColorDefinedByLogic}"/>
    
    
    <ig:CategoryXAxis.LabelSettings>
                            <ig:AxisLabelSettings Foreground="{StaticResource foregroundBrush}"/>
                        </ig:CategoryXAxis.LabelSettings>

    Should you have any further questions, please let me know.

    Sincerely,
    Tihomir Tonev
    Associate Software Developer
    Infragistics

Children