RecommendedAsConfigurableAttribute.RecommendedAsConfigurable 属性

定义

获取一个值,该值指示该特性绑定到的属性是否可用作应用程序设置。Gets a value indicating whether the property this attribute is bound to can be used as an application setting.

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

属性值

如果该特性所绑定到的属性可以作为应用程序设置使用,则为 true;否则为 falsetrue if the property this attribute is bound to can be used as an application setting; otherwise, false.

示例

下面的示例将检查 MyProperty 是否可绑定。The following example checks to see whether MyProperty is bindable. 首先,代码获取 MyProperty 的属性:First the code gets the attributes for MyProperty by:

然后,该代码将 myAttribute 设置为 AttributeCollectionRecommendedAsConfigurableAttribute 的值,并检查属性是否可绑定。Then the code sets myAttribute to the value of the RecommendedAsConfigurableAttribute in the AttributeCollection and checks whether the property is bindable.

// 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

适用于

另请参阅