Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows runtime 如何更改WinRT XAML工具箱图表控件的调色板颜色?_Windows Runtime_Windows Store Apps_Winrt Xaml_Silverlight Toolkit_Winrt Xaml Toolkit - Fatal编程技术网

Windows runtime 如何更改WinRT XAML工具箱图表控件的调色板颜色?

Windows runtime 如何更改WinRT XAML工具箱图表控件的调色板颜色?,windows-runtime,windows-store-apps,winrt-xaml,silverlight-toolkit,winrt-xaml-toolkit,Windows Runtime,Windows Store Apps,Winrt Xaml,Silverlight Toolkit,Winrt Xaml Toolkit,如何更改WinRT XAML Toolkit图表控件中图表控件的调色板颜色 例如,我想更改饼图切片的颜色。如果在工具箱的源代码中搜索“Palette”,您将看到图表控件的默认样式如何具有Palette属性,该属性是ResourceDictionary的集合。您可以在应用程序中以类似的方式将其作为图表样式或直接作为其属性应用,例如 <charting:Chart x:Name="PieChartWithCustomPalette" Title="Pie Chart with

如何更改WinRT XAML Toolkit图表控件中图表控件的调色板颜色

例如,我想更改饼图切片的颜色。

如果在工具箱的源代码中搜索“Palette”,您将看到图表控件的默认样式如何具有
Palette
属性,该属性是
ResourceDictionary
的集合。您可以在应用程序中以类似的方式将其作为图表
样式
或直接作为其属性应用,例如

<charting:Chart
    x:Name="PieChartWithCustomPalette"
    Title="Pie Chart with Custom Palette"
    Margin="70,0">
    <charting:Chart.Palette>
        <charting:ResourceDictionaryCollection>
            <!-- Blue -->
            <ResourceDictionary>
                <SolidColorBrush
                    x:Key="Background"
                    Color="#4586d8" />
                <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>
                <SolidColorBrush
                    x:Key="Background"
                    Color="#dc443f" />
                <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>
        </charting:ResourceDictionaryCollection>
    </charting:Chart.Palette>
    <charting:Chart.Series>
        <Series:PieSeries
            Title="Population"
            ItemsSource="{Binding Items}"
            IndependentValueBinding="{Binding Name}"
            DependentValueBinding="{Binding Value}"
            IsSelectionEnabled="True" />
    </charting:Chart.Series>
</charting:Chart>

我将此添加到示例项目中以供将来参考