Let’s see how we can get SelectedItem from a WPF Listbox using MVVM methodology. WPF MVVM Listbox SelectionChanged Get SelectedItem. In this example, I will be binding the WPF Listbox from MS SQL Database using MVVM ViewModel and ObservableCollection. The logic is quite simple. I’m passing a class item to ViewModel of type from which ListBox is […]
Tag: wpf listbox database

WPF MVVM Listbox Binding from SQL Database
Let’s see how we can bind WPF Listbox from SQL Database using MVVM methodology . WPF MVVM Listbox Binding from SQL Database. In this example, we will Bind a WPF Listbox using ObservableCollection from WPF ViewModel. Data is fetched from MS SQL Database table : tblCountries To see How you can fetch data from MS SQL Database and bind […]

WPF Listbox SelectionChanged – Get SelectedItem
Let’s see how we can get WPF Listbox SelectedItem and use it for displaying in a WPF Messagebox. To see How to Bind WPF Listbox from Database please visit this Post. WPF Listbox SelectionChanged – Get SelectedItem Make a simple Listbox in your WPF form as below : MainWindow.xaml: <Window x:Class=”WpfApplication2.MainWindow” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Background=”#fff” Title=”WPF ListBox […]