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。 但是,选择某一项后,该控件必须始终具有至少一个选定的项。

适用于

另请参阅