RecommendedAsConfigurableAttribute.RecommendedAsConfigurable 属性

定义

获取一个值,该值指示该特性绑定到的属性是否可用作应用程序设置。

public:
 property bool RecommendedAsConfigurable { bool get(); };
public bool RecommendedAsConfigurable { get; }
member this.RecommendedAsConfigurable : bool
Public ReadOnly Property RecommendedAsConfigurable As Boolean

属性值

如果该特性所绑定到的属性可以作为应用程序设置使用,则为 true;否则为 false

示例

以下示例检查是否 MyProperty 可绑定。 首先,代码按以下方式获取 的属性 MyProperty

然后,代码将 设置为 myAttributeAttributeCollection 的值RecommendedAsConfigurableAttribute,并检查 属性是否可绑定。

// Gets the attributes for the property.
AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes;

// Checks to see if the property is recommended as configurable.
RecommendedAsConfigurableAttribute^ myAttribute = dynamic_cast<RecommendedAsConfigurableAttribute^>(attributes[ RecommendedAsConfigurableAttribute::typeid ]);
if ( myAttribute->RecommendedAsConfigurable )
{
   // Insert code here.
}
// Gets the attributes for the property.
AttributeCollection attributes = 
   TypeDescriptor.GetProperties(this)["MyProperty"].Attributes;

// Checks to see if the property is recommended as configurable.
RecommendedAsConfigurableAttribute myAttribute = 
   (RecommendedAsConfigurableAttribute)attributes[typeof(RecommendedAsConfigurableAttribute)];
if(myAttribute.RecommendedAsConfigurable) {
   // Insert code here.
}
' Gets the attributes for the property.
Dim attributes As AttributeCollection = _
   TypeDescriptor.GetProperties(Me)("MyProperty").Attributes
       
' Checks to see if the property is recommended as configurable.
Dim myAttribute As RecommendedAsConfigurableAttribute = _
   CType(attributes(GetType(RecommendedAsConfigurableAttribute)), _
   RecommendedAsConfigurableAttribute)
   
If myAttribute.RecommendedAsConfigurable Then
    ' Insert code here.
End If

适用于

另请参阅