現在、Telerik FWでWPFプロジェクトを作成中です。:PieSeriesバインディングカラーCanFreeze警告
System.Windows.Freezable Warning: 1 : CanFreeze is returning false because a DependencyProperty on the Freezable has a value that is an expression; Freezable='System.Windows.Media.TranslateTransform'; Freezable.HashCode='36319496'; Freezable.Type='System.Windows.Media.TranslateTransform'; DP='X'; DpOwnerType='System.Windows.Media.TranslateTransform'
これは私のXAMLコード
<Style x:Key="PieSliceStyle" TargetType="Path">
<Setter Property="Fill" Value="{Binding DataItem.Color}" />
</Style>
<telerik:PieSeries ItemsSource="{Binding Source}" DefaultSliceStyle="{StaticResource PieSliceStyle}">
<telerik:PieSeries.ValueBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Value" />
</telerik:PieSeries.ValueBinding>
<telerik:PieSeries.LabelDefinitions>
<telerik:ChartSeriesLabelDefinition Margin="-10">
<telerik:ChartSeriesLabelDefinition.Binding>
<telerik:PropertyNameDataPointBinding PropertyName="Label" />
</telerik:ChartSeriesLabelDefinition.Binding>
</telerik:ChartSeriesLabelDefinition>
</telerik:PieSeries.LabelDefinitions>
</telerik:PieSeries>
であり、これは私が考える私のViewModel
private readonly SolidColorBrush PieColorEnableSlice = new SolidColorBrush(Colors.LightGray);
private readonly SolidColorBrush PieColorDisabledSlice = new SolidColorBrush(Colors.Red);
public AsyncObservableCollection<MSShareClassModel> List
{
get
{
return this._list;
}
set
{
if (this.SetProperty(ref this._list, value, "List"))
{
this.Source = new AsyncObservableCollection<PieChartModel>
{
new PieChartModel
{
Label = "Active",
Value = this._list.Count(x => x.Status == "1"),
Color = this.PieColorEnableSlice
},
new PieChartModel
{
Label = "Disable",
Value = this._list.Count(x => x.Status == "0"),
Color = this.PieColorDisabledSlice
},
};
}
}
}
の一部である:私は次の警告を取得しています実行時に
1つの解決策は、xaml源からコロナを直接作り出すことであろう。 しかし、私はこのバインディングをプログラム的に色を変更できるようにしておきたいと思います。
この警告に関するご意見はありますか?
PeharpsがDefaultSliceStyleためDynamicResourceを使用し、警告を持っている:私はすでにそれがこれは何も変わりません... –
をその警告を修正するのに役立ちますことを読んで:/ DefaultSliceStyle = "{DynamicResource PieSliceStyle} "> – pix