--- title: "How to: Navigate Through the Objects in a Data CollectionView" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "CollectionView [WPF], navigating through objects" - "data binding [WPF], navigating through objects in data CollectionView" - "navigating through objects in data CollectionView [WPF]" ms.assetid: fcd37590-bce1-4ac9-8b74-3b96c7458b8a --- # How to: Navigate Through the Objects in a Data CollectionView Views allow the same data collection to be viewed in different ways, depending on sorting, filtering, or grouping. Views also provide a current record pointer concept and enable moving the pointer. This example shows how to get the current object as well as navigate through the objects in a data collection using the functionality provided in the class. ## Example In this example, `myCollectionView` is a object that is a view over a bound collection. In the following example, `OnButton` is an event handler for the `Previous` and `Next` buttons in an application, which are buttons that allow the user to navigate the data collection. Note that the and properties report whether the current record pointer has come to the beginning and the end of the list respectively so that and can be called as appropriately. The property of the view is cast as an `Order` to return the current order item in the collection. [!code-csharp[CollectionView#OnButton](~/samples/snippets/csharp/VS_Snippets_Wpf/CollectionView/CSharp/Page1.xaml.cs#onbutton)] [!code-vb[CollectionView#OnButton](~/samples/snippets/visualbasic/VS_Snippets_Wpf/CollectionView/VisualBasic/Page1.xaml.vb#onbutton)] ## See also - [Data Binding Overview](data-binding-overview.md) - [Sort Data in a View](how-to-sort-data-in-a-view.md) - [Filter Data in a View](how-to-filter-data-in-a-view.md) - [Sort and Group Data Using a View in XAML](how-to-sort-and-group-data-using-a-view-in-xaml.md) - [How-to Topics](data-binding-how-to-topics.md)