--- title: "How to: Get a ListBoxItem" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "ListBox controls [WPF], getting a ListBoxItem" - "ListBoxItem [WPF]" ms.assetid: da877c6f-5fd8-40cb-8909-225cbfd99aa5 --- # How to: Get a ListBoxItem If you need to get a specific at a particular index in a , you can use an . ## Example The following example shows a and its items. [!code-xaml[ListBoxItems#1](~/samples/snippets/csharp/VS_Snippets_Wpf/ListBoxItems/CSharp/Window1.xaml#1)] The following example shows how to retrieve the item by specifying the index of the item in the property of the . [!code-csharp[ListBoxItems#2](~/samples/snippets/csharp/VS_Snippets_Wpf/ListBoxItems/CSharp/Window1.xaml.cs#2)] [!code-vb[ListBoxItems#2](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ListBoxItems/VisualBasic/Window1.xaml.vb#2)] After you have retrieved the list box item, you can display the contents of the item, as shown in the following example. [!code-csharp[ListBoxItems#3](~/samples/snippets/csharp/VS_Snippets_Wpf/ListBoxItems/CSharp/Window1.xaml.cs#3)] [!code-vb[ListBoxItems#3](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ListBoxItems/VisualBasic/Window1.xaml.vb#3)]