Share via


ListViewBase.SelectedRanges Property

Definition

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

public:
 property IVectorView<ItemIndexRange ^> ^ SelectedRanges { IVectorView<ItemIndexRange ^> ^ get(); };
IVectorView<ItemIndexRange> SelectedRanges();
public IReadOnlyList<ItemIndexRange> SelectedRanges { get; }
var iVectorView = listViewBase.selectedRanges;
Public ReadOnly Property SelectedRanges As IReadOnlyList(Of ItemIndexRange)

Property Value

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.

Applies to

See also