private void AddRow(object sender, MouseButtonEventArgs e) { DataGrid1.CancelEdit(); DataGrid1.SelectedIndex = -1; DataGrid1.ItemsSource = null; DataGrid1.CanUserSortColumns = false; DataGrid1.ItemsSource = workers; DataGrid1.CanUserAddRows = true; DataGrid1.Columns[1].IsReadOnly = false; DataGrid1.Columns[2].IsReadOnly = false; DataGrid1.Columns[2].Visibility = Visibility.Visible; DataGrid1.Columns[4].Visibility = Visibility.Hidden; }