private void dataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { // a cell has been edited dataGridDirty = true; }
private void QItems_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { Trace.WriteLine("CELL EDIT - Row: " + e.Row.GetIndex() + " edited\n"); quoteItemBeingEdited = e.Row.Item as QuoteItem; }
private void dataGridView_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { try { DataGridRow row = e.Row; if (null != row) { RevitView oldView = row.Item as RevitView; string propertyName = e.Column.Header.ToString(); switch (propertyName) { case "View Name": TextBox textBoxName = e.EditingElement as TextBox; if (null != textBoxName) { bool databaseUpdated = SheetDataWriter.ChangeViewItem(oldView.Id.ToString(), propertyName, textBoxName.Text); } break; case "Sheet Number": ComboBox comboBoxSheet = e.EditingElement as ComboBox; if (null != comboBoxSheet) { RevitSheet selectedSheet = comboBoxSheet.SelectedItem as RevitSheet; if (null != selectedSheet) { bool databaseUpdated = SheetDataWriter.ChangeViewItem(oldView.Id.ToString(), propertyName, selectedSheet.Id.ToString()); } } break; case "View Type": ComboBox comboBoxViewType = e.EditingElement as ComboBox; if (null != comboBoxViewType) { RevitViewType selectedViewType = comboBoxViewType.SelectedItem as RevitViewType; if (null != selectedViewType) { bool databaseUpdated = SheetDataWriter.ChangeViewItem(oldView.Id.ToString(), propertyName, selectedViewType.Id.ToString()); } } break; case "U": TextBox textBoxU = e.EditingElement as TextBox; if (null != textBoxU) { double uValue; if (double.TryParse(textBoxU.Text, out uValue)) { bool databaseUpdated = SheetDataWriter.ChangeViewItem(oldView.Id.ToString(), propertyName, uValue); } } break; case "V": TextBox textBoxV = e.EditingElement as TextBox; if (null != textBoxV) { double vValue; if (double.TryParse(textBoxV.Text, out vValue)) { bool databaseUpdated = SheetDataWriter.ChangeViewItem(oldView.Id.ToString(), propertyName, vValue); } } break; } } } catch (Exception ex) { string message = ex.Message; } }
private void ProductGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { CurrentProduct = (Product)e.Row.Item; }
private void DBCFilesGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { Start_Parsing(); }
private void Callback_DataChanged(object sender, DataGridCellEditEndingEventArgs e) { update(); }
private void DataGrid_AutoCcBccAttachedFile_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { }
private void dgArrearPre_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { try { if (e.EditAction == DataGridEditAction.Commit) { var column = e.Column as DataGridBoundColumn; if (column != null) { var sColumnName = (column.Binding as Binding).Path.Path; if (sColumnName == "YEAR") { var el = e.EditingElement as TextBox; if (!string.IsNullOrEmpty(el.Text)) { int iRow = dgArrearPre.SelectedIndex; if (!string.IsNullOrEmpty(el.Text) && Convert.ToInt32(el.Text) != 0) { dtArrearPre.Rows[iRow]["YEAR"] = el.Text; } dgArrearPre.CurrentCell = new DataGridCellInfo(dgArrearPre.Items[iRow], dgArrearPre.Columns[1]); dgArrearPre.BeginEdit(); } } else if (sColumnName == "MONTH") { var el = e.EditingElement as TextBox; if (!string.IsNullOrEmpty(el.Text)) { int iRow = dgArrearPre.SelectedIndex; if (!string.IsNullOrEmpty(el.Text)) { dtArrearPre.Rows[iRow]["MONTH"] = el.Text; } dgArrearPre.CurrentCell = new DataGridCellInfo(dgArrearPre.Items[iRow], dgArrearPre.Columns[2]); dgArrearPre.BeginEdit(); } } else if (sColumnName == "AMOUNT") { var el = e.EditingElement as TextBox; if (!string.IsNullOrEmpty(el.Text)) { int iRow = dgArrearPre.SelectedIndex; if (!string.IsNullOrEmpty(el.Text)) { if (Convert.ToInt32(el.Text) != 0) { MASTERMEMBER mm = (from mas in db.MASTERMEMBERs where mas.MEMBER_CODE == dMember_Code select mas).FirstOrDefault(); dtArrearPre.Rows[iRow]["AMOUNT"] = el.Text; dtArrearPre.Rows[iRow]["BF"] =Convert.ToInt32(mm.MONTHLYBF); dtArrearPre.Rows[iRow]["SUBSCRIPTION"] = Convert.ToInt32(el.Text)- Convert.ToInt32(mm.MONTHLYBF); fTotalAmount(); if (dgArrearPre.Items.Count <= (iRow + 1)) { fNewRow(); if (bNewRow == true) { dgArrearPre.CurrentCell = new DataGridCellInfo(dgArrearPre.Items[iRow + 1], dgArrearPre.Columns[0]); dgArrearPre.BeginEdit(); } } } } } } } } } catch (Exception ex) { ExceptionLogging.SendErrorToText(ex); } }
private void DataGrid_AutoCcBccKeyword_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { }
private void DataGrid_AutoCcBccRecipient_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { }
private void DataGrid_AlertKeywordAndMessage_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { }
private void DataGrid_NameAndDomains_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { }
private void DataGrid2D_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { editing = false; }
void BookmarkList_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { is_editing = false; }
private void DataGrid_DeferredDeliveryMinutes_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { switch (e.Column.DisplayIndex) { case 0: if (!string.IsNullOrEmpty(((TextBox)e.EditingElement).Text) && ((TextBox)e.EditingElement).Text.Contains("@")) { return; } MessageBox.Show(Properties.Resources.InputMailaddressOrDomain, Properties.Resources.AppName, MessageBoxButton.OK); e.Cancel = true; return; case 1: var regex = new Regex("[^0-9]+$"); if (!regex.IsMatch(((TextBox)e.EditingElement).Text)) { return; } MessageBox.Show(Properties.Resources.InputDeferredDeliveryTime, Properties.Resources.AppName, MessageBoxButton.OK); e.Cancel = true; break; default: return; } }
/// <summary> /// Called just before cell editing is ended. /// Gives subclasses the opportunity to cancel the operation. /// </summary> protected virtual void OnCellEditEnding(DataGridCellEditEndingEventArgs e) { if (CellEditEnding != null) { CellEditEnding(this, e); } if (AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked)) { DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer; if (peer != null) { peer.RaiseAutomationCellInvokeEvents(e.Column, e.Row); } } }
private void contractorDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { isChanged = true; }
/// <summary> /// Save values in settings for field custom decorators /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GrdCustomFieldDecorators_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { _curTableSettings.CsEntitySettings.FieldNameCustomDecorators = _fieldKeyValueListForCustomDecorators.Where(f => !string.IsNullOrEmpty(f.Value)) .ToDictionary(d => d.FieldName, d => d.Value); }
void a7DataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { //throw new NotImplementedException(); }
private void Module_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { (this.DataContext as ProjectViewModel).UpdateModule( (sender as DataGrid).SelectedItem as Variable); }
private void DataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { DataGrid tempDt = (DataGrid)sender; }
private void UC_DataGrid_Vouchers_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { VoucherSystem.Save(); }
private void TimeSlotsList_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { bCellChanged = true; }
void OnEndEditPhrase(object sender, DataGridCellEditEndingEventArgs e) => OnEndEdit(sender, e, "PHRASE", async item => await vm.Update((MUnitPhrase)item));
private void Points_CollectionChanged(object sender, DataGridCellEditEndingEventArgs e) { UpdateGraphic(); }
private void tabVeicoliParcheggiati_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { tabVeicoliParcheggiati.ItemsSource = parcheggio.VisualizzaVeicoliParcheggiati(); }
void OnEndEditWord(object sender, DataGridCellEditEndingEventArgs e) => OnEndEdit(sender, e, "WORD", async item => await vm.Update((MLangWord)item));
private void TradesGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (_tradesGridIsCellEditEnding) { return; } if ((string)e.Column.Header == "Tags") { var trade = (Trade)TradesGrid.SelectedItem; if (e.EditAction == DataGridEditAction.Commit) { //save the new tag configuration foreach (CheckListItem <Tag> item in TagPickerPopupListBox.Items) { if (item.IsChecked && !trade.Tags.Contains(item.Item)) { trade.Tags.Add(item.Item); } else if (!item.IsChecked && trade.Tags.Contains(item.Item)) { trade.Tags.Remove(item.Item); } } Context.SaveChanges(); trade.TagStringUpdated(); } TagPickerPopup.IsOpen = false; } else if ((string)e.Column.Header == "Open") { var trade = (Trade)TradesGrid.SelectedItem; bool originalOpen = (bool)Context.Entry(trade).OriginalValues["Open"]; bool?newOpen = ((CheckBox)e.EditingElement).IsChecked; if (newOpen.HasValue && newOpen.Value != originalOpen) { //The user has opened or closed the trade, //so we do a stats update to make sure the numbers are right //and set the proper closing time //first load up the collections, needed for the IsClosable() check. Context.Entry(trade).Collection(x => x.Orders).Load(); Context.Entry(trade).Collection(x => x.CashTransactions).Load(); Context.Entry(trade).Collection(x => x.FXTransactions).Load(); //if we're closing the trade, make sure it's closable first if (newOpen.Value == false && !trade.IsClosable()) { e.Cancel = true; _tradesGridIsCellEditEnding = true; ((DataGrid)sender).CancelEdit(DataGridEditingUnit.Cell); _tradesGridIsCellEditEnding = false; return; } trade.Open = newOpen.Value; Task.Run(() => { TradesRepository.UpdateStats(trade, skipCollectionLoad: true); //we can skip collection load since it's done a few lines up Context.SaveChanges(); }); } } }
private void AQRIDLookupGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { }
private void mDataGridP_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { mDataGridPointProc.CellEditEnding(sender, e); }
private void dataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { }
/// <summary> /// Invoked when the CommitEdit command is executed. /// </summary> protected virtual void OnExecutedCommitEdit(ExecutedRoutedEventArgs e) { DataGridCell cell = CurrentCellContainer; bool validationPassed = true; if (cell != null) { DataGridEditingUnit editingUnit = GetEditingUnit(e.Parameter); bool eventCanceled = false; if (cell.IsEditing) { DataGridCellEditEndingEventArgs cellEditEndingEventArgs = new DataGridCellEditEndingEventArgs(cell.Column, cell.RowOwner, cell.EditingElement, DataGridEditAction.Commit); OnCellEditEnding(cellEditEndingEventArgs); eventCanceled = cellEditEndingEventArgs.Cancel; if (!eventCanceled) { validationPassed = cell.CommitEdit(); HasCellValidationError = !validationPassed; } } // Consider commiting the row if: // 1. Validation passed on the cell or no cell was in edit mode. // 2. A cell in edit mode didn't have it's ending edit event canceled. // 3. The row can be commited: // a. The row is being edited or added and being targeted directly. // b. If the row is being edited (not added), but it doesn't support // pending changes, then tell the row to commit (this doesn't really // do anything except update the IEditableCollectionView state) if (validationPassed && !eventCanceled && (((editingUnit == DataGridEditingUnit.Row) && IsAddingOrEditingRowItem(cell.RowDataItem)) || (!EditableItems.CanCancelEdit && IsEditingItem(cell.RowDataItem)))) { DataGridRowEditEndingEventArgs rowEditEndingEventArgs = new DataGridRowEditEndingEventArgs(cell.RowOwner, DataGridEditAction.Commit); OnRowEditEnding(rowEditEndingEventArgs); if (!rowEditEndingEventArgs.Cancel) { var bindingGroup = cell.RowOwner.BindingGroup; if (bindingGroup != null) { // CommitEdit will invoke the bindingGroup's ValidationRule's, so we need to make sure that all of the BindingExpressions // have already registered with the BindingGroup. Synchronously flushing the Dispatcher to DataBind priority lets us ensure this. // Had we used BeginInvoke instead, IsEditing would not reflect the correct value. Dispatcher.Invoke(new DispatcherOperationCallback(DoNothing), DispatcherPriority.DataBind, bindingGroup); validationPassed = bindingGroup.CommitEdit(); } HasRowValidationError = !validationPassed; if (validationPassed) { CommitRowItem(); } } } if (validationPassed) { // Update the state of row editing UpdateRowEditing(cell); } // CancelEdit and CommitEdit rely on IsAddingNewItem and IsEditingRowItem CommandManager.InvalidateRequerySuggested(); } e.Handled = true; }
private void Main_DG_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { var a = (e.EditingElement as TextBox).Text; // new text var b = e.Row.Item; // element }
/// <summary> /// Invoked when the CancelEdit command is executed. /// </summary> protected virtual void OnExecutedCancelEdit(ExecutedRoutedEventArgs e) { DataGridCell cell = CurrentCellContainer; if (cell != null) { DataGridEditingUnit editingUnit = GetEditingUnit(e.Parameter); bool eventCanceled = false; if (cell.IsEditing) { DataGridCellEditEndingEventArgs cellEditEndingEventArgs = new DataGridCellEditEndingEventArgs(cell.Column, cell.RowOwner, cell.EditingElement, DataGridEditAction.Cancel); OnCellEditEnding(cellEditEndingEventArgs); eventCanceled = cellEditEndingEventArgs.Cancel; if (!eventCanceled) { cell.CancelEdit(); HasCellValidationError = false; } } var editableItems = EditableItems; bool needsCommit = IsEditingItem(cell.RowDataItem) && !editableItems.CanCancelEdit; if (!eventCanceled && (CanCancelAddingOrEditingRowItem(editingUnit, cell.RowDataItem) || needsCommit)) { bool cancelAllowed = true; if (!needsCommit) { DataGridRowEditEndingEventArgs rowEditEndingEventArgs = new DataGridRowEditEndingEventArgs(cell.RowOwner, DataGridEditAction.Cancel); OnRowEditEnding(rowEditEndingEventArgs); cancelAllowed = !rowEditEndingEventArgs.Cancel; } if (cancelAllowed) { if (needsCommit) { // If the row is being edited (not added), but it doesn't support // pending changes, then tell the item to commit (this doesn't really // do anything except update the IEditableCollectionView state). // This allows us to exit row editing mode. editableItems.CommitEdit(); } else { CancelRowItem(); } var bindingGroup = cell.RowOwner.BindingGroup; if (bindingGroup != null) { bindingGroup.CancelEdit(); // This is to workaround the bug that BindingGroup // does nor clear errors on CancelEdit bindingGroup.UpdateSources(); } } } // Update the state of row editing UpdateRowEditing(cell); if (!cell.RowOwner.IsEditing) { // Allow the user to cancel the row and avoid being locked to that row. // If the row is still not valid, it means that the source data is already // invalid, and that is OK. HasRowValidationError = false; } // CancelEdit and CommitEdit rely on IsAddingNewItem and IsEditingRowItem CommandManager.InvalidateRequerySuggested(); } e.Handled = true; }
void grid_CommittingEdit(object sender, DataGridCellEditEndingEventArgs e) { DbObject item = (DbObject) e.Row.Item; EditFired.Fire(this,item); }