protected virtual void OnCellValidating(EditableDataGridCellValidatingEventArgs e) { if (CellValidating != null) { this.CellValidating(this, e); } }
protected virtual bool NotifyCellValidating(object value) { EditableDataGridCellValidatingEventArgs e = new EditableDataGridCellValidatingEventArgs() { Column = this, RowIndex = this.EditRow, Value = value, }; Owner.OnCellValidatingInternal(e); return(e.Cancel); }
internal void OnCellValidatingInternal(EditableDataGridCellValidatingEventArgs e) { this.OnCellValidating(e); }
void _dataGrid_CellValidating(object sender, EditableDataGridCellValidatingEventArgs e) { if (e.Column == this._logNumColumn) { var cellValue = e.Value as string; int newLogNumber; if (TryParseInt(cellValue, out newLogNumber)) { if (!this.IsLogNumAvalible(newLogNumber)) { e.Cancel = true; } } else { //if value not a number, cancel e.Cancel = true; } } }
protected override void OnCellValidating(EditableDataGridCellValidatingEventArgs e) { base.OnCellValidating(e); TreeVM tree = (TreeVM)this._BS_trees[e.RowIndex]; if (e.Column == _sgColumn) { var newSG = e.Value as SampleGroupDO; e.Cancel = !tree.HandleSampleGroupChanging(newSG, this); //this.DataEntryController.HandleSampleGroupChanging(curTree, e.Value as SampleGroupDO, out cancel); } else if (e.Column == _speciesColumn) { //no action required return; } else if (e.Column == _stratumColumn) { var newSt = e.Value as StratumDO; e.Cancel = !tree.HandleStratumChanging(newSt, this); //this.DataEntryController.HandleStratumChanging(tree, e.Value as StratumDO, out cancel); //this.HandleStratumChanging(currTree, e.Value as StratumDO, out cancel); } else if (e.Column == _treeNumberColumn) { try { long newTreeNum = (long)e.Value; if (tree.TreeNumber != newTreeNum && !this.DataEntryController.Unit.IsTreeNumberAvalible(newTreeNum)) { MessageBox.Show("Tree Number already exists"); e.Cancel = true; } } catch { e.Cancel = true; } } else if (e.Column == _kpiColumn) { bool cancel = false; this.DataEntryController.HandleKPIChanging(tree, (float)e.Value, false, out cancel); //this.HandleKPIChanging(currTree, (float)e.Value, out cancel); } }
void editableDataGrid1_CellValidating(object sender, EditableDataGridCellValidatingEventArgs e) { editableDataGrid1.Focus(); }
protected virtual bool NotifyCellValidating(object value) { EditableDataGridCellValidatingEventArgs e = new EditableDataGridCellValidatingEventArgs() { Column = this, RowIndex = this.EditRow, Value = value, }; Owner.OnCellValidatingInternal(e); return e.Cancel; }
void _dataGrid_CellValidating(object sender, EditableDataGridCellValidatingEventArgs e) { TreeVM tree = null; try { tree = this.ViewLogicController.CurrentTree; } catch { e.Cancel = true; return; } if (e.Column == _sgColumn) { var newSG = e.Value as SampleGroupDO; tree.HandleSampleGroupChanging(newSG, this); //this.HandleSampleGroupChanging(tree, e.Value as SampleGroupDO, out cancel); } else if (e.Column == _speciesColumn) { //no action required return; } else if (e.Column == _treeNumberColumn) { try { long newTreeNum = (long)e.Value; if (tree.TreeNumber != newTreeNum && !this.ViewLogicController.CurrentPlot.IsTreeNumberAvalible(newTreeNum)) { this.ShowMessage("Tree Number already exists"); e.Cancel = true; } } catch { e.Cancel = true; } } else if (e.Column == _kpiColumn) { bool cancel = false; this.ViewLogicController.DataEntryController.HandleKPIChanging(tree, (float)e.Value, true, out cancel); //this.HandleKPIChanging(tree, (float)e.Value, out cancel); e.Cancel = cancel; } }