Greetings,
I have a bit of a puzzle with a hierarchical xamGrid in 12.2. The grid is three levels, bound to business objects via MVVM. Let's call them Parent, Child, and Grandchild, where the root XamGrid is bound to a collection of Parent, each of which has a collection of Child, each of which has a collection of Grandchild. So, it looks something similar to the following:
<xamGrid ItemsSource={Binding Path=Parents}>
..regular columns..
<ColumnLayout Key=Children>
<ColumnLayout Key=Grandchildren>
...
Now the interesting behavior:
I've tried reproducing in a simple project, and I can't, and it would take too long to get a decent enough of a sample that is as complex as the one I'm working with -- I have styles, bindings, validations, and propagating notify property changes galore. So, I will understand if you can't give me a definitive answer.
But I am just asking if you can have one of the gurus look at the callstack and code for the xamGrid and see if you can give me a sniff as to what could be causing this. If not, then I'm going to have to implement my own new row functionality, and that would break convention for the rest of the application. It's not the end of the world, but it would certainly be less than ideal!
Thanks,
Bill Raiford
Error (I had to type this out...4 min!!):
An unhandled exception ('Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.NullReferenceException: Object reference not set to an
instance of an object.
at
Infragistics.ControlsGrids.Primitives.RowsPanel.ScrollCellIntoView(CellBase
cell, CellAlignment alignment, EmptyDelegate callback)
at Infragistics.Controls.Grids.XamGrid.ScrollCellIntoView(CellBase cell,
CellAlignment alignment, EmptyDelegate callback)
at Infragistics.Controls.Grids.XamGrid.SetActiveCell(CellBase cell,
CellAlignment alignment, InvokeAction action, Boolean allowSelection,
Boolean setFocus, Boolean scrollIntoView)
Boolean scrollIntoView)
CellAlignment alignment, InvokeAction action, Boolean allowSelection)
at Infragistics.Controls.Grids.Cell.OnCellMouseDown(MouseEventArgs e)
Infragistics.Controls.Grids.XamGrid.OnGridMouseLeftButtonDown(Mousebu...
e)
Infragistics.Controls.Grids.XamGrid.XamWebGrid_MouseLeftButtonDown(O...
sender, MouseButtonEventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex,
Delegate handlerDelegate, Object sender, Objecct args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr
unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String
eventName, UInt32 flags)
') occurred in iexplore.exe [6540].
Hello Bill,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well. Also if we are able to track the source of this exception we will fix this and we will let you know.
Thanks again.
Well, like I said - I also created a sample project and could not reproduce the problem. My specific request was "But I am just asking if you can have one of the gurus look at the callstack and code for the xamGrid and see if you can give me a sniff as to what could be causing this". If you can't look at the source code, no big deal. ;)
I did find a workaround. In the code behind, on the ActiveCellChanging, I have the following:
if (e.NewActiveCell != null && e.NewActiveCell.Control == null)
e.Cancel = true;
It turned out that the NewActiveCell.Control was null when it was entering the cell for some reason. With this check in place, I no longer get the error - it simply cancels the navigation. I have it in the code-behind and not the viewmodel, but it's not too egregious as a workaround.
Thanks for your help,
Hello William,
Thank you for your post. I have been looking into it and I created a sample project for you following your scenario and everything seems to work ok on my side. If you can modify it, so it reproduces your behavior we will be happy to assist you further with this.
Looking forward for your reply.