MergablePropertyAttribute.AllowMerge 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个值,该值指示此属性是否可以与属于属性窗口中其他对象的属性组合。
public:
property bool AllowMerge { bool get(); };
public bool AllowMerge { get; }
member this.AllowMerge : bool
Public ReadOnly Property AllowMerge As Boolean
属性值
如果此属性可以与属于属性窗口中其他对象的属性组合,true;否则为 false。
示例
以下示例检查是否 MyProperty 适合合并。 首先,代码获取以下项的属性 MyProperty :
检索 PropertyDescriptorCollection 对象的所有属性。
索引到要获取PropertyDescriptorCollection的
MyProperty。在属性变量中保存此属性的属性。
然后,代码将设置为myAttribute中MergablePropertyAttribute值AttributeCollection,并检查属性是否适合合并。
// Gets the attributes for the property.
AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyPropertyProperty" ]->Attributes;
// Checks to see if the property is bindable.
MergablePropertyAttribute^ myAttribute = dynamic_cast<MergablePropertyAttribute^>(attributes[ MergablePropertyAttribute::typeid ]);
if ( myAttribute->AllowMerge )
{
// Insert code here.
}
// Gets the attributes for the property.
AttributeCollection attributes =
TypeDescriptor.GetProperties(this)["MyPropertyProperty"].Attributes;
// Checks to see if the property is bindable.
MergablePropertyAttribute myAttribute = (MergablePropertyAttribute)attributes[typeof(MergablePropertyAttribute)];
if (myAttribute.AllowMerge)
{
// Insert code here.
}
' Gets the attributes for the property.
Dim attributes As AttributeCollection = _
TypeDescriptor.GetProperties(Me)("MyPropertyProperty").Attributes
' Checks to see if the property is bindable.
Dim myAttribute As MergablePropertyAttribute = _
CType(attributes(GetType(MergablePropertyAttribute)), _
MergablePropertyAttribute)
If myAttribute.AllowMerge Then
' Insert code here.
End If