Back to Devexpress

DataControlBase.SaveLayoutToXml(String) Method

wpf-devexpress-dot-xpf-dot-grid-dot-datacontrolbase-dot-savelayouttoxml-x28-system-dot-string-x29.md

latest3.5 KB
Original Source

DataControlBase.SaveLayoutToXml(String) Method

SECURITY-RELATED CONSIDERATIONS

Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.

Saves a control’s layout to a file in XML format.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public void SaveLayoutToXml(
    string path
)
vb
Public Sub SaveLayoutToXml(
    path As String
)

Parameters

NameTypeDescription
pathString

A String value that specifies the target file name.

|

Remarks

To restore a control’s layout previously saved by the SaveLayoutToXml method, use the DataControlBase.RestoreLayoutFromXml method.

Note

Detail grids aren’t automatically serialized when saving the master grid’s layout. To learn more, see Master-Detail Mode Limitations.

To learn more, see Saving and Restoring Layout.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SaveLayoutToXml(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

how-to-prevent-certain-gridcontrols-properties-from-being-serialized-t158989/CS/WpfApplication58/MainWindow.xaml.cs#L23

csharp
void OnSaveLayout(object sender, RoutedEventArgs e) {
    grid.SaveLayoutToXml("layout.xml");
}

how-to-prevent-certain-gridcontrols-properties-from-being-serialized-t158989/VB/WpfApplication58/MainWindow.xaml.vb#L27

vb
Private Sub OnSaveLayout(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Me.grid.SaveLayoutToXml("layout.xml")
End Sub

See Also

SaveLayoutToStream(Stream)

DataControlBase Class

DataControlBase Members

DevExpress.Xpf.Grid Namespace