![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Displaying the index of a ListItem Is there a way to get the index of a list box item to display it in the datatemplate of a list box? tia Florian |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Displaying the index of a ListItem You can obtain the index of a ListBoxItem by asking it to the ItemGenerator of the ListBox... myListBox.ItemcontainerGenerator.IndexFromContainer(myListBoxItem); >From that point, you can either place your index in the ControlTemplate of the ListBoxItem trough the ItemContainerStyle of the Listbox or, whitin the DataTemplate of the data item, you could do a binding using RelativeSource to retrieve the ListBoxItem. Hope this gives you the information you were looking for... Florian Kruesch wrote: > Is there a way to get the index of a list box item to > display it in the datatemplate of a list box? > > tia > Florian |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Displaying the index of a ListItem thanks for the hint. Do you see a way to do that in XAML only or at most using a ValueConverter, but without invoking any method? Florian Marcus wrote: > You can obtain the index of a ListBoxItem by asking it to the > ItemGenerator of the ListBox... > > myListBox.ItemcontainerGenerator.IndexFromContainer(myListBoxItem); |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Vista not displaying Windows Experience Index | Vista performance & maintenance | |||
| Displaying Photos | Vista music pictures video | |||
| Displaying progress ? | PowerShell | |||
| Displaying Ram etc | Vista General | |||
| Displaying Ram etc | Vista performance & maintenance | |||