Skip to main content
All docs
V26.1
  • SchedulerControl.SaveLayoutToJson(Stream) Method

    Saves the Scheduler’s layout to a file in JSON format.

    Namespace: DevExpress.XtraScheduler

    Assembly: DevExpress.XtraScheduler.v26.1.dll

    Declaration

    public void SaveLayoutToJson(
        Stream utf8jsonStream
    )

    Parameters

    Name Type Description
    utf8jsonStream Stream

    The layout in UTF-8 encoded JSON format.

    Remarks

    Use the RestoreLayoutFromJson(Stream) method to load the layout from a file in JSON format.

    ```csharp {5,11} string filePath = “scheduler-layout.json”; void Form1_Load(object sender, EventArgs e) { if (File.Exists(filePath)) { using (var jsonStream = File.OpenRead(filePath)) schedulerControl1.RestoreLayoutFromJson(jsonStream); } }

    void Form1_FormClosing(object sender, FormClosingEventArgs e) { using (var jsonStream = File.OpenWrite(filePath)) schedulerControl1.SaveLayoutToJson(jsonStream); }

    # [VB.NET](#tab/tabid-vb)
    
    ```vb{5,12}
    Private filePath As String = "scheduler-layout.json"
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
      If File.Exists(filePath) Then
        Using jsonStream = File.OpenRead(filePath)
          schedulerControl1.RestoreLayoutFromJson(jsonStream)
        End Using
      End If
    End Sub
    
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs)
      Using jsonStream = File.OpenWrite(filePath)
        schedulerControl1.SaveLayoutToJson(jsonStream)
      End Using
    End Sub
    

    Tip

    Use the Persistence Behavior or Workspace Manager component to save and restore layouts for all DevExpress UI controls simultaneously.

    See Also