Wpf 用户控件:使复杂的属性可编辑 [英] Wpf user control: makes complex properties editable
问题描述
假设你在wpf中创建了一个标准的UserControl或者CustomControl,然后声明了一个复杂类型的属性
Suppose you create a standard UserControl or a CustomControl in wpf and then declare a property of a complex type
public ComplexPropertyType AProperty { get;放;}
public ComplexPropertyType AProperty { get; set; }
复杂类型是一个带有一堆属性的简单类
Complex type is a simple class with a bunch of properties
public class ComplexPropertyType
{
public int IntP { get; set; }
public String Strp { get; set; }
}
在设计时 AProperty 不可编辑.
At design time AProperty is not editable.
我记得 System.ComponentModel 中有一些属性允许我指定使用标准属性编辑器来使该属性可编辑,但我不记得了.
I remember that there are attributes from System.ComponentModel that permits me to specify to use a standard property editor to make that property editable, but I cannot remember.
有没有人有明确不需要编写自定义属性编辑器的解决方案?毕竟,如果我在我的控件中声明一个属性是复杂类型 E 的集合.
Anyone has a solution that clearly does not require writing a custom property editor? After all If I declare in my control a property that is a collection of complex type Es.
public ObservableCollection ACollOfProperty { get;放;}
public ObservableCollection ACollOfProperty { get; set; }
设计人员自动使用能够编辑我的复杂类型的 System.ComponentModel.Design.CollectionEditor
Automatically the designer use the System.ComponentModel.Design.CollectionEditor that is capable of editing my complex type
提前致谢.
推荐答案
在 wpf 中你可以使用这个 http://wpg.codeplex.com/ 或使用此 winform 控制
In wpf you can use this http://wpg.codeplex.com/ or use this winform contro
这篇关于Wpf 用户控件:使复杂的属性可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!