コード例 #1
0
 private void BtnDeletePerson_Click(object sender, RoutedEventArgs e)
 {
     if (DgdPerson.SelectedIndex == -1)
     {
         return;
     }
     PersonId.RemoveAt(DgdPerson.SelectedIndex);
     PersonName.RemoveAt(DgdPerson.SelectedIndex);
     PersonFamily.RemoveAt(DgdPerson.SelectedIndex);
     PersonFather.RemoveAt(DgdPerson.SelectedIndex);
     PersonCode.RemoveAt(DgdPerson.SelectedIndex);
     _createPersons = new List <CreatePerson>();
     for (var i = 0; i < PersonId.Count; i++)
     {
         _createPersons.Add(new CreatePerson(PersonId[i], PersonName[i], PersonFamily[i], PersonFather[i],
                                             PersonCode[i]));
     }
     DgdPerson.ItemsSource = _createPersons;
 }