ערוך

שתף באמצעות


CollectionView.CurrentItem Property

Definition

Gets the current item in the view.

public:
 virtual property System::Object ^ CurrentItem { System::Object ^ get(); };
public virtual object CurrentItem { get; }
member this.CurrentItem : obj
Public Overridable ReadOnly Property CurrentItem As Object

Property Value

The current item of the view. By default, the first item of the collection starts as the current item.

Implements

Remarks

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(Object, Int32) method to update the current values stored in the base class.

Applies to