How to get Listbox item from the listbox wpf -


I want to scroll the listbobs which are placed inside the srollviewer according to their selection.

  list box item = (list box item) (lbTrack.ItemContainerGenerator.ContainerFromItem (lbTrack.Items.CurrentItem)); // listbox item item = (listbloxime) (lbTrack.ItemContainerGenerator.ContainerFromItem (lbTrack.SelectedItem)); If (item! = Null) {item.BringIntoView (); }  

But this is giving zero value.

Hope this helps:

  if (listView .SelectedItem! = Null) {listView.ScrollIntoView (listView.SelectedItem); }  

Comments