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
120
Why is my UltraGridRow ListObject null after loading a serialized DisplayLayout
posted

I am using an Infragistics UltraGrid in my WinForms application. Infragistics v13.1.

I have recently added code to save grid layouts in a binary serialized format and load them back using the CopyFrom method on the DisplayLayout object.

While I load one of these saved layouts, the grid is modified appropriately and data still shows correctly in the grid, but any time I ask for a ListObject on a row, it returns null. The datasource for the grid is a BindingSource whose DataSource is a BindingList (this data is not changed when the layout is loaded).

Save:

Dim MS As New IO.MemoryStream()
ugl.Save(MS, Infragistics.Win.UltraWinGrid.PropertyCategories.All)
Return MS.ToArray()

Load:

Private Function ConvertToUltraGridLayout(data As Byte()) As UltraGridLayout
    Dim ugl As New UltraGridLayout()
    Dim MS As New IO.MemoryStream(data)
    MS.Seek(0, IO.SeekOrigin.Begin)
    ugl.Load(MS, Infragistics.Win.UltraWinGrid.PropertyCategories.All)
    Return ugl
End Function

dgrServices.DisplayLayout.CopyFrom(ConvertToUltraGridLayout(lOption.Layout))

What do I need to do to get the ListObject to be non-null?

Thanks!