/// <summary> /// Raises the CommittingRowEdit event. /// </summary> protected virtual void OnCommittingRowEdit(DataGridRowCancelEventArgs e) { EventHandler<DataGridRowCancelEventArgs> handler = this.CommittingRowEdit; if (handler != null) { handler(this, e); } }
private DataGridDataErrorEventArgs CommitRowEdit(bool exitEditingMode) { if (this._editingRow == null) { return null; } Debug.Assert(this.EditingRowIndex >= -1); Debug.Assert(this.EditingRowIndex < this._rowCount); DataGridDataErrorEventArgs dataError = null; DataGridRowCancelEventArgs e = new DataGridRowCancelEventArgs(this._editingRow); OnCommittingRowEdit(e); if (e.Cancel) { dataError = new DataGridDataErrorEventArgs(null, this.CurrentColumn, this._editingRow); dataError.Cancel = true; return dataError; } try { if (!this.DataConnection.EndEdit(this._editingRow.DataContext)) { dataError = new DataGridDataErrorEventArgs(null, this.CurrentColumn, this._editingRow); return dataError; } if (!exitEditingMode && !this.DataConnection.BeginEdit(this._editingRow.DataContext)) { dataError = new DataGridDataErrorEventArgs(null, this.CurrentColumn, this._editingRow); return dataError; } } catch (Exception ex) { dataError = new DataGridDataErrorEventArgs(ex, this.CurrentColumn, this._editingRow); OnDataError(dataError); return dataError; } return null; }
// /// <summary> /// Raises the CleaningRow event for row recycling. /// </summary> protected virtual void OnCleaningRow(DataGridRowCancelEventArgs e) { EventHandler<DataGridRowCancelEventArgs> handler = this.CleaningRow; if (handler != null) { handler(this, e); } }