我正在为WPF和Silverlight开发一个自定义控件。该控件具有一个复杂类型的集合属性,该类型是抽象的,例如:
public Collection<MyBase> Configuration
{
get { return (Collection<MyBase>)GetValue(ConfigurationProperty); }
set { SetValue(ConfigurationProperty, value); }
}
// Using a DependencyProperty as the backing store for Configuration This enables animation, styling, binding, etc...
public static readonly DependencyProperty ConfigurationProperty =
DependencyProperty.Register("Configuration", typeof(Collection<MyBase>), typeof(MyControl), new PropertyMetadata(new ObservableCollection<MyBase>()));
我的问题是,我无法在Visual Studio 2010的设计器中添加新项,因为它不知道MyBase的任何派生类型。
有没有办法向设计器注册这些类型?编辑器可以正常使用现有项目,并且可以删除和修改它们。以下是一张图片以进行说明: