Hi
I wanted to restore column order of the grid to the layout in the form_load, after the columns have been moved around. So I save it when the form loads, and trying to restore it when the button is clicked. I don't want to use Save/Load it to/from a stream file, rather save it in an object so it can be restore later, and discarded after application closed. Here is the code I have but it does not work:
private void Form1_Load( object sender, EventArgs e )
{
.......
// populate binding datasource which is the datasource of the grid
this.bindingSource1.DataSource = datassource1;
_layout = this.ultraGrid1.DisplayLayout;
private void button1_Click( object sender, EventArgs e )
this.ultraGrid1.DisplayLayout.Load( _layout, PropertyCategories.All );
//this.ultraGrid1.Invalidate();
//this.ultraGrid1.Refresh();
Form1_Load( sender, e );
}
Please help! Thanks.
You can't do it like this:
becuase this just creates a reference to the layout, not a copy. So you need to create a clone of the original layout.
_layout = this.ultraGrid1.DisplayLayout.Clone();