ISelectionItemProvider.IsSelected 属性

定义

获取一个值,该值指示某个项是否处于选定状态。

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

属性值

Boolean

如果元素已选定,则为 true;否则为 false

示例

以下示例代码返回 true 此项是否位于所选项的集合中。

/// <summary>
/// Specifies whether the item is selected.
/// </summary>
/// <remarks>
/// selectedItems is the collection of selected ListItems.
/// </remarks>
public bool IsSelected
{
    get
    {
        return selectedItems.Contains(this);
    }
}
''' <summary>
''' Specifies whether the item is selected.
''' </summary>
''' <remarks>
''' selectedItems is the collection of selected ListItems.
''' </remarks>
Public ReadOnly Property IsSelected() As Boolean Implements ISelectionItemProvider.IsSelected
    Get
        Return selectedItems.Contains(Me)
    End Get
End Property

适用于

另请参阅