private void vpUpRow_Click(object sender, RoutedEventArgs e) { AttachedDocumentItem w = new AttachedDocumentItem(); int si = vpdTable.SelectedIndex; if (si > 0 && si < ADIList.Count) { w = ADIList[si - 1]; ADIList[si - 1] = ADIList[si]; ADIList[si] = w; } CollectionViewSource.GetDefaultView(vpdTable.ItemsSource).Refresh(); }
private void vpAddRow_Click(object sender, RoutedEventArgs e) { int sel = vpdTable.SelectedIndex; try { if (sel > -1) { ADIList.Add(new AttachedDocumentItem()); AttachedDocumentItem w = new AttachedDocumentItem(); for (int i = ADIList.Count - 2; i > sel; i--) { w = ADIList[i + 1]; ADIList[i + 1] = ADIList[i]; ADIList[i] = w; } } else { ADIList.Add(new AttachedDocumentItem()); } } catch (System.Exception ex) { MessageBox.Show(ex.Message); } CollectionViewSource.GetDefaultView(vpdTable.ItemsSource).Refresh(); }