private void OnRowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { if (NodeContext == null) return; if (e.EditAction == DataGridEditAction.Commit) { var property = e.Row.DataContext as UIMetadata; if (property != null) { if (string.IsNullOrEmpty(property.Name.Trim())) { return; } else { if (property.OriginalName == property.Name || !property.IsInserted) { NodeContext.Updates.Add(new UpdateMetadataDetail { Type = UpdateMetadataType.AddOrUpdateValue, NewKey = property.Name, NewValue = property.Value }); property.OriginalName = property.Name; if (!property.IsInserted) { property.IsInserted = true; } } else { NodeContext.Updates.Add(new UpdateMetadataDetail { Type = UpdateMetadataType.UpdateKey, Key = property.OriginalName, NewKey = property.Name, NewValue = property.Value }); } } if (_source.AugmentedCollection.All(q => q.IsInserted)) { _source.NewLine(); NodeMetadataDataGrid.ItemsSource = null; NodeMetadataDataGrid.ItemsSource = _source; } } } }
private void dataGrid_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { ProdottoContext context = ddsProdotti.DomainContext as ProdottoContext; if (context.HasChanges) { try { context.SubmitChanges(); } catch (Exception ex) { ErrorWindow.CreateNew(ex); } } }
private void plansDataGrid_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { // if (DataGridEditAction.Commit == e.EditAction) // { // PlanEntity planEntity = e.Row.DataContext as PlanEntity; // DateTime targetDateTime = planEntity.TargetDateAdjustment2.HasValue ? planEntity.TargetDateAdjustment2.Value : // (planEntity.TargetDateAdjustment1.HasValue ? planEntity.TargetDateAdjustment1.Value : planEntity.TargetDate); // if (null == planEntity.AccomplishDate) // { // DateTime currentDateTime = DateTime.Now; // TimeSpan difference = targetDateTime - currentDateTime; // if (difference.Days > remindDay) // { // e.Row.Background = new SolidColorBrush(Colors.Gray); // } // else if (difference.Days >= 0 && difference.Days <= remindDay) // { // e.Row.Background = new SolidColorBrush(Colors.Magenta); // } // else // { // e.Row.Background = new SolidColorBrush(Colors.Red); // } // } // else // { // if (targetDateTime >= planEntity.AccomplishDate) // { // e.Row.Background = new SolidColorBrush(Colors.Green); // } // else // { // e.Row.Background = new SolidColorBrush(Colors.Purple); // } // } // } }
private void dgEstimate_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { EDetails ed =e.Row.DataContext as EDetails; ed.SAmount = Math.Round(ed.Quantity * ed.SCost); CalculateSTotal(sender); }
private void dgRequisition_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { RDetails rd = e.Row.DataContext as RDetails; rd.SAmount = Math.Round(rd.Quantity * rd.SCost); CalculateSTotal(sender); }
/// <summary> /// Raises the <see cref="E:System.Windows.Controls.DataGrid.RowEditEnded"/> event. /// </summary> /// <param name="e">The event data.</param> protected override void OnRowEditEnded(DataGridRowEditEndedEventArgs e) { base.OnRowEditEnded(e); if (e.EditAction == DataGridEditAction.Commit) { Graphic relatedGraphic = DataSourceCreator.GetGraphicSibling(e.Row.DataContext); if (relatedGraphic != null) { try { e.Row.RefreshGraphic(relatedGraphic, objectType); } catch { } } } }
//属性编辑结束,提交新的属性信息 private void dgVegetable_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { List<string> getEntityFieldValues = new List<string>(); if (dgVegetable != null) { getEntityFieldValues.Add(listVegetable[0].SmID); getEntityFieldValues.Add(listVegetable[0].SmUserID); getEntityFieldValues.Add(listVegetable[0].SmPerimeter); getEntityFieldValues.Add(listVegetable[0].SmArea); getEntityFieldValues.Add(listVegetable[0].ClassID); } //FieldNames与FieldValues必须一一对应 Entity entity = new Entity { Shape = shape, ID = entityID, FieldNames = getEntityFieldNames, FieldValues = getEntityFieldValues }; UpdateEntityParameters parameters = new UpdateEntityParameters { MapName = "Changchun", LayerName = "Vegetable@changchun", Entity = entity }; //与服务器交互更新地物属性 UpdateEntityService updateEntityService = new UpdateEntityService("http://localhost:7080/demo"); updateEntityService.ProcessAsync(parameters); updateEntityService.Failed += new EventHandler<ServiceFailedEventArgs>(Service_Failed); updateEntityService.ProcessCompleted += new EventHandler<EditEventArgs>(Service_ProcessCompleted); }
/// <summary> /// Raises the RowEditEnded event. /// </summary> protected virtual void OnRowEditEnded(DataGridRowEditEndedEventArgs e) { EventHandler<DataGridRowEditEndedEventArgs> handler = this.RowEditEnded; if (handler != null) { handler(this, e); } // Raise the automation invoke event for the row that just ended edit because the edits // to its associated item have either been committed or reverted DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer; if (peer != null && AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked)) { peer.RaiseAutomationInvokeEvents(DataGridEditingUnit.Row, null, e.Row); } }
private void dgrDescontosServicos_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { AdministracaoContext administracaoContext = new AdministracaoContext(); ConvenioPlanoSaudeSet convenioSelecionado = (ConvenioPlanoSaudeSet)convenioPlanoSaudeSetDataGrid.SelectedItem; DescontoServico descontoServicoAlterado = (DescontoServico)((DataGrid)sender).SelectedItem; LoadOperation<ConvenioServicoSet> loadOp = administracaoContext.Load<ConvenioServicoSet>(administracaoContext.GetConvenioServicoSet_IdQuery(descontoServicoAlterado.Id)); loadOp.Completed += (s3, e3) => { ConvenioServicoSet descontoServico = administracaoContext.ConvenioServicoSets.Where<ConvenioServicoSet>(desc => desc.id == descontoServicoAlterado.Id).Single<ConvenioServicoSet>(); descontoServico.porcentagem_desconto = descontoServicoAlterado.Desconto; administracaoContext.SubmitChanges(); }; }
protected override void OnRowEditEnded(DataGridRowEditEndedEventArgs e) { base.OnRowEditEnded(e); }
private void MyDataGrid_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { EditFeaturesParameters updateParameters = new EditFeaturesParameters { EditType = EditType.UPDATA, Features = new FeatureCollection { MyDataGrid.SelectedFeatures[0] }, IDs = new List<int> { Convert.ToInt32(MyDataGrid.SelectedFeatures[0].Attributes["SMID"].ToString()) } }; EditFeaturesService updateByAttributesService = new EditFeaturesService(url2); updateByAttributesService.ProcessAsync(updateParameters); updateByAttributesService.ProcessCompleted += new EventHandler<EditFeaturesEventArgs>(updateByAttributesService_ProcessCompleted); updateByAttributesService.Failed += new EventHandler<ServiceFailedEventArgs>(updateByAttributesService_Failed); }
void CustomGrid_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { CustomGrid_LoadingRow(sender, new DataGridRowEventArgs(e.Row)); }
/// <summary> /// 本事件句柄处理的是DataGrid控件的RowEdited事件。 /// 在事件中调用ADO.NET Data Service,更新了被编辑的Grade数据。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mainDataGrid_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { ScoreCardForSchoolLinqToEntities s = e.Row.DataContext as ScoreCardForSchoolLinqToEntities; if (s != null) { CourseGrade recordforupdate = s.CourseGrade; _entities.UpdateObject(recordforupdate); _entities.BeginSaveChanges(SaveChangesOptions.ReplaceOnUpdate, OnChangesSaved, _entities); } }
private void dgPlayType_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { PlayTypeInfo lottery = e.Row.DataContext as PlayTypeInfo; if (lottery.PlayTypeName == currentEditionName) { (this.dgPlayType.Columns[3].GetCellContent(e.Row) as TextBlock).Text = currentEditionName; (this.dgPlayType.Columns[1].GetCellContent(e.Row) as TextBlock).Tag = lottery; (this.dgPlayType.Columns[3].GetCellContent(e.Row) as TextBlock).Tag = lottery; (this.dgPlayType.Columns[4].GetCellContent(e.Row) as Button).Tag = lottery; return; } srv = WcfProxy.GetProxy; srv.UpdatePlayTypeNameCompleted += (s, er) => { loadingProgress.IsBusy = false; if (er.Result) { (this.dgPlayType.Columns[3].GetCellContent(e.Row) as TextBlock).Text = lottery.PlayTypeName; (this.dgPlayType.Columns[1].GetCellContent(e.Row) as TextBlock).Tag = lottery; (this.dgPlayType.Columns[3].GetCellContent(e.Row) as TextBlock).Tag = lottery; (this.dgPlayType.Columns[4].GetCellContent(e.Row) as Button).Tag = lottery; } }; srv.UpdatePlayTypeNameAsync(lottery); loadingProgress.IsBusy = true; }
private void DataGrid_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { if (e.EditAction != DataGridEditAction.Commit) return; var persistent = e.Row.DataContext as Base; if (persistent == null) return; persistent.Save(); // Saving Item to Storage Storage.Commit(); // Commiting changes }