我目前正在与Telerik防火墙的WPF项目。
在运行时,我收到以下警告:
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
},
};
}
}
}我认为一种解决方案是直接从xaml源代码创建corlor。但我希望保留此绑定,以便能够以编程方式更改颜色。
你对这个警告有什么想法吗?
发布于 2016-05-31 22:01:26
好的,经过更多的调查,这不是来自pieSeries的。这是由RadGridView触发的.
我从xaml中逐个删除了所有的xaml组件。最后一个活着的是网格,我一直有那个警告。我删除了网格并启用了所有其他组件,直到我在xaml中取消对网格的注释,警告才会消失。没有什么花哨的东西,只是简单的RadGridView声明。没有DataSource或列定义,只有一个简单的空网格。
自2010年以来,这个问题似乎已经从许多组件中声明给了telerik开发团队。(树状视图、网格等...)
经过一些阅读,Telerik不会解决这类问题。(我们可以在http://feedback.telerik.com/上投票支持它:)
我不会将此作为答案,我仍然有警告=/
https://stackoverflow.com/questions/37520834
复制相似问题