private void btnPaste_Click(object sender, RoutedEventArgs e) { if (FPTemplateRowForCopying != null) { FPTemplateRow FPTemplateRow = new FPTemplateRow() { FixedPatternTemplate = this.FixedPatternTemplate, //auto increment sl no for each additional row SlNo = FPTemplateRows.Max(p => p.SlNo) + 1, Density = FPTemplateRowForCopying.Density, Designation = FPTemplateRowForCopying.Designation, Location = FPTemplateRowForCopying.Location, Segment = FPTemplateRowForCopying.Segment, Sensitivity = FPTemplateRowForCopying.Sensitivity, FilmSizeString = FPTemplateRowForCopying.FilmSizeString, FilmCount = FPTemplateRowForCopying.FilmCount, FilmSize = FPTemplateRowForCopying.FilmSize, ThicknessRange = FPTemplateRowForCopying.ThicknessRange, ThicknessRangeUI = FPTemplateRowForCopying.ThicknessRangeUI, SFD = FPTemplateRowForCopying.SFD }; FPTemplateRows.Add(FPTemplateRow); OnPropertyChanged("FPTemplateRows"); } else { MessageBox.Show("Please copy anyone row to paste!!"); return; } }
public void CopyOperation(object sender, RoutedEventArgs e) { FPTemplateRowForCopying = new FPTemplateRow(); DataGridRow row = DataGridRow.GetRowContainingElement(sender as FrameworkElement); FPTemplateRowForCopying = (FPTemplateRow)row.DataContext; }
public override void AddOperation(object sender, RoutedEventArgs e) { //also give a few default empty string values so that UI copy operation is possible FPTemplateRow FPTemplateRow = new FPTemplateRow() { FixedPatternTemplate = this.FixedPatternTemplate, //auto increment sl no for each additional row SlNo = FPTemplateRows.Max(p => p.SlNo) + 1, Density = " ", Designation = " ", Location = " ", Segment = " ", Sensitivity = " ", FilmSizeString = " ", }; FPTemplateRows.Add(FPTemplateRow); OnPropertyChanged("FPTemplateRows"); }