I am trying to get the value (content) of the selected item from a listbox in wpf. This is the code I am using in the codebehind. I get an error that says "Unable to cast object of type 'Users' to type 'System.Windows.Controls.L
'". Can you help me get the value?
ListBoxItem lbi = (ListBoxItem)(this.lstUsers.ItemContainerGenerator.ContainerFromIndex(this.lstUsers.SelectedIndex) as ListBoxItem).Content;