GridControl.SaveLayoutToXml() Method

Saves a gird's layout to an XML string.

Namespace: DevExpress.Mobile.DataGrid

Assembly: DevExpress.Mobile.Grid.v18.2.dll

Declaration

public string SaveLayoutToXml()
Public Function SaveLayoutToXml As String

Returns

Type Description
String

A string to which a grid's layout settings should be stored.

Remarks

Use the SaveLayoutToXml method to save a GridControl's layout as an XML string. You can then restore saved settings using the GridControl.RestoreLayoutFromXml method.

Examples

The following sample code shows how to save the current layout of the grid to an XML string on a button click and restore it on another button click. The GridControl.SaveLayoutToXml and GridControl.RestoreLayoutFromXml methods are used.

string customState = String.Empty;

void SaveButton_Click(object sender, EventArgs e) {
    // Save the grid's layout.
    customState = grid.SaveLayoutToXml();
}

void LoadButton_Click(object sender, EventArgs e) {
    // Restore the previously saved layout.
    grid.RestoreLayoutFromXml(customState);
}
See Also