Проблема с static readonly PropertyData в обобщенном классе используя Catel
Использую WPF Catel. Столкнулся с проблемой:
//обошенный класс унаследованный от ModelBase
public sealed class TestType<T> : ModelBase
{
#region Constructor
public TestType()
{
}
#endregion
#region Properties
public ushort Val
{
get { return GetValue<ushort>(ValProperty); }
set { SetValue(ValProperty, value); }
}
public static readonly PropertyData ValProperty = RegisterProperty("Val", typeof(ushort));
#endregion
}
//ВьюМодель гдя я использую Модель
public class MainWindowViewModel : ViewModelBase
{
#region Properties
[Model]
public TestType<bool> Xxx
{
get { return GetValue<TestType<bool>>(XxxProperty); }
set { SetValue(XxxProperty, value); }
}
public static readonly PropertyData XxxProperty = RegisterProperty("Xxx", typeof(TestType<bool>));
#endregion
#region Commands
private Command _editCommand;
public Command EditCommand
{
get
{
return _editCommand ?? (_editCommand = new Command(
() =>
{
Xxx = new TestType<bool>();
},
() => true));
}
}
#endregion
}
при присваивании в теле команды возникает исключение Xml сереализации, когда Xxx помечен атрибутом [Model].
И решарпер ругается: статичное поле в обобщенном классе
public static readonly PropertyData XxxProperty
Если класс TestType сделать обычным то ошибки не будет. Сделать PropertyData не статичным не получается ругается катель. Подскажите пожалуйста как быть.