Questo articolo è stato tradotto automaticamente. Per visualizzare l'articolo in inglese, selezionare la casella di controllo Inglese. È possibile anche visualizzare il testo inglese in una finestra popup posizionando il puntatore del mouse sopra il testo.

Proprietà CollectionView.CurrentItem


Data di pubblicazione: novembre 2016

Ottiene l'elemento corrente della visualizzazione.

Spazio dei nomi:   System.Windows.Data
Assembly:  PresentationFramework (in PresentationFramework.dll)

public virtual object CurrentItem { get; }

Valore proprietà

Type: System.Object

Elemento corrente della visualizzazione. Per impostazione predefinita, il primo elemento della raccolta inizia come elemento corrente.

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 T:System.Windows.Controls.ItemsControl, the current item is synchronized with the selected item. For example, if a list box is bound to a collection, the P:System.Windows.Data.CollectionView.CurrentItem is synchronized with the currently selected item.

Note per gli eredi:

Only classes that pass currency handling calls to another internal T:System.Windows.Data.CollectionView object should override this property; all other derived classes should use the M:System.Windows.Data.CollectionView.SetCurrent(System.Object,System.Int32) method to update the current values stored in the base class.

.NET Framework
Disponibile da 3.0
Torna all'inizio