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
LoadFromXML grid layout overwrites column visibility for columns that did not exist in the grid before.

We want to be able to add columns to the grid, but be able to choose to show or hide them based on code. 

Currently the code is set up in the initialize grid event to set visibility and such, then call the LoadGridlayout.  In the InitializeGrid event, we loop through the columns and using a select case we handle the columns.  We have a Case Else that handles those columns that we do not want visible or have not coded for yet.  If a column falls into this Case Else (which all new columns not coded yet should), then they should be hidden.  However, when I add a new column to the dataset, it is visible instead of being hidden.  If I skip over the LoadLayout call, it is hidden as expected. 

Why then, does the layout overwrite a column's properties that did not exist in its saved layout?

To give you the basics of what we are doing:

On Form Load, we bind the data 

UltraGrid1.DataSource = DataSet

followed by (a few lines later) the load layout

UltraGrid1.DisplayLayout.LoadFromXml(layoutStream, Infragistics.Win.UltraWinGrid.PropertyCategories.All)

The Datsource line fires off the Initialize event (_InitializeLayout)

Here we loop thru the columns and if we are not expecting it or do not want to do anything special with it, we want to hide it.  So in a Case Else we set the Column's Hidden property = True

After this occurs, the load layout line fires, and the column still shows.

No Data
  • 37774

    While I'm not quite sure why loading a layout will override the visibility of a new column in the DataSet.  One option could be that you have the NewColumnLoadStyle property of the DisplayLayout serialized in the layout, so that when you load this layout it's showing the new column.  Does this problem still occur if you have the NewColumnLoadStyle set to Hide?


No Data