TreeList.SaveLayoutToJson(Stream, OptionsLayoutBase) Method
Saves the TreeList’s layout settings specified by the OptionsLayout property to a file in JSON format.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v26.1.dll
Declaration
Parameters
| Name | Type | Description |
|---|---|---|
| utf8jsonStream | Stream | The layout in UTF-8 encoded JSON format. |
| options | OptionsLayoutBase | Options that define which layout settings to save. null (Nothing in Visual Basic) or OptionsLayoutBase.FullLayout to save all layout settings. |
Remarks
Use the RestoreLayoutFromJson method to load the layout from a file in JSON format.
string filePath = "treelist-layout.json";
void Form1_Load(object sender, EventArgs e) {
if (File.Exists(filePath)) {
using (var jsonStream = File.OpenRead(filePath))
treeList1.RestoreLayoutFromJson(jsonStream);
}
}
void Form1_FormClosing(object sender, FormClosingEventArgs e) {
using (var jsonStream = File.OpenWrite(filePath))
treeList1.SaveLayoutToJson(jsonStream);
}
Tip
Use the Persistence Behavior or Workspace Manager component to save and restore layouts for all DevExpress UI controls simultaneously.
See Also