Version

Save/Load a Layout to a File

WinGrid™ can save and reload a previously saved layout allowing your end users to setup the WinGrid in a particular fashion for their needs and come back and restore it to that layout. For example say an end user always wants the data shown in the grid to be GroupBy a particular column. He could make his GroupBy and save the layout, and then next time he opens the form just reload the saved layout and the GroupBy is applied.

  1. The SaveAsXml and LoadFromXml method of the Layout save the WinGrid’s Layout into an Xml file.

In Visual Basic:

Private Sub btnSave_Click(ByVal sender As System.Object, _
  ByVal e As System.EventArgs) Handles btnSave.Click
	Me.UltraGrid1.DisplayLayout.SaveAsXml("WinGridLayout.xml")
End Sub

In C#:

private void btnSave_Click(object sender, System.EventArgs e)
{
	this.ultraGrid1.DisplayLayout.SaveAsXml("WinGridLayout.xml");
}
  1. To Load the layout into the grid is similar to Save.

In Visual Basic:

Private Sub btnLoad_Click(ByVal sender As System.Object, _
  ByVal e As System.EventArgs) Handles btnLoad.Click
	Me.UltraGrid1.DisplayLayout.LoadFromXml("WinGridLayout.xml")
End Sub

In C#:

private void btnLoad_Click(object sender, System.EventArgs e)
{
	this.ultraGrid1.DisplayLayout.LoadFromXml("WinGridLayout.xml");
}