private void CheckBox_Checked2(object sender, RoutedEventArgs e) { if (ListaKlijenata.SelectedItem == null) { MessageBox.Show("Please select a client"); return; } var klient = clients.ElementAt(ListaKlijenata.SelectedIndex); ProfileDTO client; if (klient.nonLocked) { client = ClientRequests.toogleLockedUser(klient); } else { client = ClientRequests.toogleLockedUser2(klient); } clients = ClientRequests.getClients(); ListaKlijenata.ItemsSource = clients; }