作者:.NET开发
项目:System.ComponentMode
[MergableProperty(true)]
public int MyProperty {
get {
// Insert code here.
return 0;
}
set {
// Insert code here.
}
}
作者:.NET开发
项目:System.ComponentMode
// Gets the attributes for the property.
AttributeCollection attributes =
TypeDescriptor.GetProperties(this)["MyProperty"].Attributes;
// Checks to see if the value of the MergablePropertyAttribute is Yes.
if(attributes[typeof(MergablePropertyAttribute)].Equals(MergablePropertyAttribute.Yes)) {
// Insert code here.
}
// This is another way to see if the property is bindable.
MergablePropertyAttribute myAttribute =
(MergablePropertyAttribute)attributes[typeof(MergablePropertyAttribute)];
if(myAttribute.AllowMerge) {
// Insert code here.
}
作者:.NET开发
项目:System.ComponentMode
AttributeCollection attributes =
TypeDescriptor.GetAttributes(MyProperty);
if(attributes[typeof(MergablePropertyAttribute)].Equals(MergablePropertyAttribute.Yes)) {
// Insert code here.
}