通过


ISelectionProvider.IsSelectionRequired 属性

定义

获取一个值,该值指定UI 自动化提供程序是否需要至少选择一个子元素。

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

属性值

true 如果需要选择,则为否则 false

示例

以下示例演示了一个列表的此方法的实现,该列表要求随时选择项。

/// <summary>
/// Specifies whether the list must have an item selected at all times.
/// </summary>
bool ISelectionProvider.IsSelectionRequired
{
    get
    {
        return true;
    }
}
''' <summary>
''' Specifies whether the list must have an item selected at all times.
''' </summary>
Private ReadOnly Property IsSelectionRequired() As Boolean Implements ISelectionProvider.IsSelectionRequired
    Get
        Return True
    End Get
End Property

注解

此属性可以是动态的。 例如,默认情况下,控件的初始状态可能没有任何项目处于选中状态,也就是说IsSelectionRequiredfalse。 但是,选择某个项后,控件必须始终至少选择一个项。

适用于

另请参阅