private void EndDataUpdate(DataProviderStatusChangedEventArgs e) { if (e.NewStatus == DataProviderStatus.Faulted || e.NewStatus == DataProviderStatus.Uninitialized) { this.CleanUp(); this.ResumeUpdateService(UpdateFlags.AllButData); return; } if (!this.isDataProviderUpdating) { Debug.Assert(RadControl.IsInTestMode, "Flag not raised properly."); return; } if (e.NewStatus != DataProviderStatus.Ready || !e.ResultsChanged) { return; } //// NOTE: This call comes from another thread and everything related to the UI should be dispatched on the UI thread. //// It will also clear the IndexTree which will definitely throw NullReference exception if some UI operation is requested before Dispatcher is invoked. //// To solve this issue it will be better to create new Layout class and replace the existing one when dispatched to the Main thread. //// this.SetLayoutSource(); this.GridView.UpdateService.DispatchOnUIThread( true, () => { if (this.CurrentDataProvider.Status != DataProviderStatus.Ready) { // This may happen if during the Dispatching on UI thread we have a change in the provider - e.g. ItemsSource change. return; } if (this.hasPendingDataRefresh) { this.hasPendingDataRefresh = false; this.RefreshData(); return; } this.updatingData = true; this.GenerateColumns(); this.SetRowLayoutSource(); UpdateFlags uiUpdateflags = UpdateFlags.AffectsContent | UpdateFlags.AffectsDecorations; // check the data update flags and create the appropriate UI update if (this.dataChangeFlags.HasFlag(DataChangeFlags.Group) || this.dataChangeFlags.HasFlag(DataChangeFlags.Filter)) { uiUpdateflags |= UpdateFlags.AffectsColumnsWidth; } var eventArgs = new DataBindingCompleteEventArgs() { ChangeFlags = this.dataChangeFlags, DataView = this.GridView.GetDataView() }; this.dataChangeFlags = DataChangeFlags.None; this.isDataProviderUpdating = false; this.updatingData = false; this.GridView.CommandService.ExecuteCommand(CommandId.DataBindingComplete, eventArgs); Debug.Assert(!uiUpdateflags.HasFlag(UpdateFlags.AffectsData), "The AffectsData flag should not be raised here!"); this.ResumeUpdateService(uiUpdateflags); this.NotifyView(this.CurrentDataProvider.Status); }); }
private void playerStats_DataBindingComplete(object sender, DataBindingCompleteEventArgs e) { //e.ChangeFlags }