CollectionView.CurrentItem Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the current item in the view.

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

public virtual object CurrentItem { 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.

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
Available since 3.0
Return to top