Windows runtime 如何更改WinRT XAML工具箱图表控件的调色板颜色?
如何更改WinRT XAML Toolkit图表控件中图表控件的调色板颜色 例如,我想更改饼图切片的颜色。如果在工具箱的源代码中搜索“Palette”,您将看到图表控件的默认样式如何具有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
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>
我将此添加到示例项目中以供将来参考