Skip to main content

DataGridView.SaveLayoutToXml() Method

Saves the gird’s layout to an XML string.

Namespace: DevExpress.XamarinForms.DataGrid

Assembly: DevExpress.XamarinForms.Grid.dll

NuGet Package: DevExpress.XamarinForms.Grid

#Declaration

C#
public string SaveLayoutToXml()

#Returns

Type Description
String

A string to which the grid’s layout settings are written.

#Remarks

Call the SaveLayoutToXml method to save the DataGridView‘s layout as an XML string. You can then use the RestoreLayoutFromXml method to restore saved settings.

#Example

This example shows how to use the SaveLayoutToXml and RestoreLayoutFromXml methods to save the current layout of the grid to an XML string when you click a button and restore it when you click another button.

using DevExpress.XamarinForms.DataGrid;
// ...

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