在我的uwp项目中依赖属性时发生FxCop警告

时间:2017-06-30 06:02:02

标签: uwp dependency-properties readonly fxcop

在我的项目中,我使用了依赖项目,如下面的代码片段所示。

 public bool ShowAllDay
 {
       get { return (bool)GetValue(ShowAllDayProperty); }
       set { SetValue(ShowAllDayProperty, value); }
 }

 /// <summary>
 /// Using a DependencyProperty as the backing store for ShowAllDay.  This enables animation, styling, binding, etc...
 /// </summary>
 public static readonly DependencyProperty ShowAllDayProperty =
            DependencyProperty.Register("ShowAllDay", typeof(bool), typeof(MyClass), new PropertyMetadata(true, OnShowAllDayChanged));

它出现以下警告,我怎么能清楚这个?

严重级代码描述项目文件行抑制状态 警告CA2104从“MyClass.ShowAllDayProperty”中删除只读名称,或将字段更改为不可变引用类型。如果引用类型'DependencyProperty'实际上是不可变的,则排除此消息。

0 个答案:

没有答案
相关问题