Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
675
2009.1 xamDataGrid breaks
posted

Two lines, to re-assign a data source to a xamDataGrid (we do this a lot)

grid.DataSource = null;
grid.DataSource = rows;  // rows is IList<>

First pass, second line generates:

System.InvalidOperationException occurred
  Message="Can't set the DataSource on a DataPresenter that has items added explicitly through the DataItems collection."
  Source="Infragistics3.Wpf.DataPresenter.v9.1"
  StackTrace:
       at Infragistics.Windows.DataPresenter.DataPresenterBase.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at Infragistics.Windows.DataPresenter.XamDataGrid.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyPropertyKey key, Object value)
       at Infragistics.Windows.DataPresenter.DataPresenterBase.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at Infragistics.Windows.DataPresenter.XamDataGrid.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at Infragistics.Windows.DataPresenter.DataPresenterBase.set_DataSource(IEnumerable value)
       at GED.Frameworks.EnerPrise.UserInterface.ScenarioInspector.SetGridDataSource(IList`1 rows) in C:\Enerprise\Dev\Analytics0109\Source\Shared Components\User Interface Legacy\ScenarioInspector\ScenarioInspector.xaml.cs:line 450
  InnerException:

Second pass, first line generates:

System.ArgumentException was unhandled
  Message="DefaultFieldLayout can only be set to a FieldLayout contained in the FieldLayouts collection."
  Source="Infragistics3.Wpf.DataPresenter.v9.1"
  StackTrace:
       at Infragistics.Windows.DataPresenter.DataPresenterBase.set_DefaultFieldLayout(FieldLayout value)
       at Infragistics.Windows.DataPresenter.FieldLayout.set_IsDefault(Boolean value)
       at Infragistics.Windows.DataPresenter.DataPresenterBase.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at Infragistics.Windows.DataPresenter.XamDataGrid.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyPropertyKey key, Object value)
       at Infragistics.Windows.DataPresenter.DataPresenterBase.VerifyRecordManagerDataSource()
       at Infragistics.Windows.DataPresenter.DataPresenterBase.InitializeRecordManagerDataSource()
       at Infragistics.Windows.DataPresenter.DataPresenterBase.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at Infragistics.Windows.DataPresenter.XamDataGrid.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyPropertyKey key, Object value)
       at Infragistics.Windows.DataPresenter.DataPresenterBase.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at Infragistics.Windows.DataPresenter.XamDataGrid.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at Infragistics.Windows.DataPresenter.DataPresenterBase.set_DataSource(IEnumerable value)
       at GED.Frameworks.EnerPrise.UserInterface.ScenarioInspector.SetGridDataSource(IList`1 rows) in C:\Enerprise\Dev\Analytics0109\Source\Shared Components\User Interface Legacy\ScenarioInspector\ScenarioInspector.xaml.cs:line 449
       at GED.Frameworks.EnerPrise.UserInterface.ScenarioInspector.SetGridDataSource(InspectorData inspectorData) in C:\Enerprise\Dev\Analytics0109\Source\Shared Components\User Interface Legacy\ScenarioInspector\ScenarioInspector.xaml.cs:line 444
       at GED.Frameworks.EnerPrise.UserInterface.ScenarioInspector.Model_LoadingFinished(Object sender, LoadingCompleteEventArgs data) in C:\Enerprise\Dev\Analytics0109\Source\Shared Components\User Interface Legacy\ScenarioInspector\ScenarioInspector.xaml.cs:line 260
       at GED.Frameworks.EnerPrise.UserInterface.InspectorModel.LoadComplete(Object sender, RunWorkerCompletedEventArgs e) in C:\Enerprise\Dev\Analytics0109\Source\Shared Components\User Interface Legacy\ScenarioInspector\InspectorModel.cs:line 610
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Application.RunInternal(Window window)
       at Henwood.Shared.Enerprise.API.Dashboard.App.Main() in C:\Enerprise\Dev\Analytics0109\Source\Applications\Enerprise.Dashboard\obj\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Neither of these ever occurred in 2008.3. Any thoughts? We love (nay, NEED) the new features, but we're dead in the water right now.

  • 675
    Verified Answer
    posted

    Never mind, it was me. Ugh.

    For future reference, this is what happens if you have a FieldSettings without wrapping it in a XamDataGrid.FieldSettings.