Hi
I've a MVVM application with very simple grid defined as follow (below the grid configuration):
<igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="False" AutoFitMode="OnlyWithVisibleStarFields" AllowAddNew="False" AllowDelete="False" FilterUIType="LabelIcons" RecordSelectorLocation="None" SelectionTypeRecord="Single" SelectionTypeCell="Single" SelectionTypeField="Single" /> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields> <igDP:Field Name="Name" Label="Name" Width="0.5*"></igDP:Field> <igDP:UnboundField Name="TokenPrefix" Label="Token prefix" BindingPath="TokenPrefix" BindingMode="OneWay" Width="0.5*"></igDP:UnboundField> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
It works great. Now, I wanted to initially sort the items based on Name field. I've updated following markup:
<igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields> <igDP:Field Name="Name" Label="Name" Width="0.5*"></igDP:Field> <igDP:UnboundField Name="TokenPrefix" Label="Token prefix" BindingPath="TokenPrefix" BindingMode="OneWay" Width="0.5*"></igDP:UnboundField> </igDP:FieldLayout.Fields> <igDP:FieldLayout.SortedFields> <igDP:FieldSortDescription Direction="Descending" FieldName="Name" /> </igDP:FieldLayout.SortedFields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts>
And now, when Grid is showing there is a "Object reference not set to an instance of an object.".
I've no idea what I'm doing wrong. Here is the stack trace:
Infragistics.Windows.DataPresenter.Internal.TemplateDataRecordCache.InitializeCachedCellArea() at Infragistics.Windows.DataPresenter.Internal.TemplateDataRecordCache.VerifyCache() at Infragistics.Windows.DataPresenter.Internal.TemplateDataRecordCache.GetCellValuePresenter(Field field, Boolean createIfNull) at Infragistics.Windows.DataPresenter.CellTextConverterInfo..ctor(Field field) at Infragistics.Windows.DataPresenter.CellTextConverterInfo.GetCachedConverter(Field field) at Infragistics.Windows.DataPresenter.RecordManager.SameFieldRecordsSortComparer.FieldSortInfo.Initialize(FieldSortDescription fieldSortDescription, SameFieldRecordsSortComparer comparerInfo, FieldLayout fieldLayout) at Infragistics.Windows.DataPresenter.RecordManager.SameFieldRecordsSortComparer.FieldSortInfo..ctor(FieldSortDescription fieldSortDescription, SameFieldRecordsSortComparer comparerInfo, FieldLayout fieldLayout) at Infragistics.Windows.DataPresenter.RecordManager.SameFieldRecordsSortComparer..ctor(FieldLayout fieldLayout, Int32 recordsBeingSortedCount, Boolean areRecordsInUnsortedOrder) at Infragistics.Windows.DataPresenter.RecordManager.SortHelper(Record[] records, Boolean hasGroupByFields, Boolean& hasMultipleFieldLayouts, Boolean areRecordsInUnsortedOrder) at Infragistics.Windows.DataPresenter.RecordManager.VerifySort() at Infragistics.Windows.DataPresenter.RecordManager.OnSourceCollectionReset() at Infragistics.Windows.DataPresenter.RecordManager.PostDelayedReset() at Infragistics.Windows.DataPresenter.RecordManager.SetDataSource(IEnumerable currentValue, Boolean postReset) at Infragistics.Windows.DataPresenter.RecordManager.set_DataSource(IEnumerable value) at Infragistics.Windows.DataPresenter.DataPresenterBase.VerifyRecordManagerDataSource() at Infragistics.Windows.DataPresenter.DataPresenterBase.InitializeRecordManagerDataSource() at Infragistics.Windows.DataPresenter.DataPresenterBase.get_CurrentRecordListControl() at Infragistics.Windows.DataPresenter.DataPresenterBase.VerifyContentSiteGrid() at Infragistics.Windows.DataPresenter.DataPresenterBase.OnApplyTemplate() at System.Windows.FrameworkElement.ApplyTemplate() at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Border.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Control.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.ContextLayoutManager.UpdateLayout() at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg) at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork() at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) 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, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) 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.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at FT.Desktop.UI.App.Main() in C:\depot\ws\depot\Forecasting Tools\Sources\FT.Desktop\obj\x86\Debug\UI\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
HI,
I took your xaml and created a XamDataGrid Project. I could not reproduce.
I am using build 11.2.2076.
Please run the attached project on your machine.
Feel free to modify it so that it replicates.
Sincerely, Matt Developer Support Engineer
Hi Matt
Thx for feedback.I found the reason!
Using your sample with version 2011.1 - works great
Using your sample with version 2011.1 SR - i got NullReference exception.
The version we are using in production is 2011.1 SR (the latest and greatest right?)
Can you check if this is bug on your side with this latest SR?
If Yes - can you provide a workaround ?
Thx in advance.