
看到了吧? ComplexProperty 属性的子属性 Max, Min 也可以被编辑了.
实现这些很简单,只需要在这个属性的类型的类型转换器中重载两个方法即可
1
/// <summary>
2
/// 使用指定的上下文返回该对象是否支持属性 (Property)。
3
/// </summary>
4
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
5
{
6
return true;
7
}
8
9
/// <summary>
10
/// 使用指定的上下文和属性 (Attribute) 返回由 value 参数指定的数组类型的属性 (Property) 的集合。
11
/// </summary>
12
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, System.Attribute[] attributes)
13
{
14
return TypeDescriptor.GetProperties(typeof(SimpleCustomType), attributes);
15
}
16
/// <summary>2
/// 使用指定的上下文返回该对象是否支持属性 (Property)。3
/// </summary>4
public override bool GetPropertiesSupported(ITypeDescriptorContext context)5
{6
return true;7
}8

9
/// <summary>10
/// 使用指定的上下文和属性 (Attribute) 返回由 value 参数指定的数组类型的属性 (Property) 的集合。11
/// </summary>12
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, System.Attribute[] attributes)13
{14
return TypeDescriptor.GetProperties(typeof(SimpleCustomType), attributes);15
}16

The end.


浙公网安备 33010602011771号