CollectionView::CurrentItem Property

Gets the current item in the view.

Namespace:  System.Windows.Data
Assembly:  PresentationFramework (in PresentationFramework.dll)

public:
virtual property Object^ CurrentItem {
	Object^ get ();
}

Property Value

Type: System::Object
The current item of the view. By default, the first item of the collection starts as the current item.

Implements

ICollectionView::CurrentItem

Collection views support the concept of a current record pointer. As you navigate through the objects in a collection view, you are moving a record pointer that allows you to retrieve the object that exists at that particular location in the collection.

Note that moving the current record pointer has some interactions with any sorting or filtering that is applied to the collection. Sorting preserves the current record pointer on the last record selected, but the collection view is restructured around it. (Perhaps the selected record was at the beginning of the list before, but now the selected record might be somewhere in the middle.) Filtering preserves the selected record if that selection remains in view after the filtering. Otherwise, the current record pointer is set to the first record of the filtered collection view.

The current item of the collection is bound to automatically if the target of a binding is a singleton value. If the target is an ItemsControl, the current item is synchronized with the selected item. For example, if a list box is bound to a collection, the CurrentItem is synchronized with the currently selected item.

Notes to Inheritors

Only classes that pass currency handling calls to another internal CollectionView object should override this property; all other derived classes should use the SetCurrent method to update the current values stored in the base class.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft