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
115
Infragistics.UltraWinGrid problems adding a column after DisplayLayout.LoadFromXml
posted

I have an untrawingrid bound to a custom collection.

There is a DisplayLayout that we've serialized to XML that we share with users. 

We want to add an unbound column after the user loads the grid's displaylayout.  The sequence looks like this:

Dim stream As New IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(LayoutString))
myGrid.LoadFromXml(stream, PropertyCategories.All)
myGrid.DisplayLayout.LoadFromXml(stream, PropertyCategories.All)

which works wonderfully.  All the default columns and sizing/sorting/etc. is persisted.

However, when we try to add a column, it winds up overwriting an existing column (being displayed, but not in the underlying object itself, it seems):

myGrid.DisplayLayout.Bands(0).Columns.Add("isLocked")

As soon as we do this and the grid is refreshed, a column that used to be displayed is renamed "isLocked".

Looking at the displaylayout columns in code, everything seems fine, but the overwritten column will no longer be displayed.

Here's the displaylayout loaded:

here's what happens after calling myGrid.DisplayLayout.Bands(0).Columns.Add("isLocked"):

I feel like I'm doing everything right and maybe this is just a bug in the grid?

Parents
No Data
Reply
  • 1500
    Offline posted

    Hello,

    Thank you for posting on our forums.

    Is it possible that the data source of the grid where you load the layout does not match the data source of the grid which was used to create the layout.

    It is best to set the layout after the datasource have been already set. I have tested this on my end and the unbound column is being added at the end, as no other position is specified.

    Attaching the sample for further reference.

    In order to test it, change sorting, sizing of columns of the upper grid, save the layout(will have to adjust the path in the methods), then you can load the modified layout and add the unbound column.

    Should you have further questions, please let me know.

    Sincerely,
    Tihomir Tonev
    Associate Software Developer
    Infragistics

    GridLoadFromXML.zip

Children