ListViewBase.SelectedRanges ListViewBase.SelectedRanges ListViewBase.SelectedRanges ListViewBase.SelectedRanges Property

Definition

Gets a collection of ItemIndexRange objects that describe the currently selected items in the list.

public : IVectorView<ItemIndexRange> SelectedRanges { get; }
IVectorView<ItemIndexRange> SelectedRanges();
public IReadOnlyList<ItemIndexRange> SelectedRanges { get; }
Public ReadOnly Property SelectedRanges As IReadOnlyList<ItemIndexRange>

Property Value

IReadOnlyList<ItemIndexRange> IReadOnlyList<ItemIndexRange>

The collection of ItemIndexRange objects that describe the currently selected items in the list. The default is an empty collection.

Remarks

Each ItemIndexRange in the SelectedRanges collection describes a contiguous block of selected items. ItemIndexRange describes the selection by index, so item objects don't need to be created. This is a more efficient way to describe item selection than using SelectedItems, which requires the actual item object to be created for each selected item.

If your datasource performs data virtualization, you can use the SelectedRanges property with the SelectRange and DeselectRange methods to modify selection of items that have not been created yet.

Note

If the ItemsSource implements IItemsRangeInfo, the SelectedItems collection is not updated based on selection in the list. Use the SelectedRanges property instead.

See also