Im having list box and I want to add to it items and when I tried with the following code I got error
Object reference not set to an instance of an object."
the error is when I do item source = _userList ,
what am I doing wrong here?
public ObservableCollection<User> _UsersList = new ObservableCollection<User>();public MainWindow()
{
_UsersList.Add(new User {Name = "Mike"});
_UsersList.Add(new User { Name = "Nick" });
listbox1.ItemsSource = _UsersList;
DataContext = this;
InitializeComponent();