Silverlight Toolkit - 如何设置线序列图的刻度颜色

时间:2011-01-11 11:00:59

标签: silverlight windows-phone-7 silverlight-toolkit

我正处于一个Silverlight线系列图表的中间,并且因为我的生活无法确定如何在我的图表上设置主题时间段的颜色

在浅色背景上显示它们看起来很棒,但是在黑暗的背景上它们看不见(它们是黑色的)

任何帮助将不胜感激

感谢 道格

1 个答案:

答案 0 :(得分:1)

当您查看Silverlight Toolkit图表的内置样式时,您将看到以下内容:

<!--  charting:Chart  -->
<Style TargetType="charting:Chart">
    <Setter Property="BorderBrush" Value="Black" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Padding" Value="10" />
    <Setter Property="Palette">
        <Setter.Value>
            <datavis:ResourceDictionaryCollection>
                <!-- Blue -->
                <ResourceDictionary>
                    <RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
                        <GradientStop Color="#FFB9D6F7" />
                        <GradientStop Color="#FF284B70" Offset="1" />
                    </RadialGradientBrush>
                    <Style x:Key="DataPointStyle" TargetType="Control">
                        <Setter Property="Background" Value="{StaticResource Background}" />
                    </Style>
                    <Style x:Key="DataShapeStyle" TargetType="Shape">
                        <Setter Property="Stroke" Value="{StaticResource Background}" />
                        <Setter Property="StrokeThickness" Value="2" />
                        <Setter Property="StrokeMiterLimit" Value="1" />
                        <Setter Property="Fill" Value="{StaticResource Background}" />
                    </Style>
                </ResourceDictionary>
                <!-- Red -->
                <ResourceDictionary>
                    <RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
                        <GradientStop Color="#FFFBB7B5" />
                        <GradientStop Color="#FF702828" Offset="1" />
                    </RadialGradientBrush>
                    <Style x:Key="DataPointStyle" TargetType="Control">
                        <Setter Property="Background" Value="{StaticResource Background}" />
                    </Style>
                    <Style x:Key="DataShapeStyle" TargetType="Shape">
                        <Setter Property="Stroke" Value="{StaticResource Background}" />
                        <Setter Property="StrokeThickness" Value="2" />
                        <Setter Property="StrokeMiterLimit" Value="1" />
                        <Setter Property="Fill" Value="{StaticResource Background}" />
                    </Style>
                </ResourceDictionary>

颜色来自Palette属性 - 据我所知,每个新系列都会从此调色板中获取另一个条目。