logo
VitNX3 Documentation

# VitNX_DockPanel.RestoreDockPanelState Method

Namespace: VitNX.UI.ControlsV1.Docking
Assembly: VitNX3 (in VitNX3.dll)
VB
C#
F#
C++
JScript
Copy

    public void RestoreDockPanelState(
       DockPanelState state,
       Func<string, VitNX_DockContent> getContentBySerializationKey
    )

    This language is not supported or no code example is available.

#### Parameters

state
  DockPanelState

getContentBySerializationKey
  Func<string, VitNX_DockContent>

Source code
VB
C#
F#
C++
JScript
Copy

    public void RestoreDockPanelState(DockPanelState state,
         Func<string, VitNX_DockContent> getContentBySerializationKey)
     {
         foreach (var region in state.Regions)
         {
             switch (region.Area)
             {
                 case VitNX_DockArea.Left:
                     _regions[VitNX_DockArea.Left].Size = region.Size;
                     break;

                 case VitNX_DockArea.Right:
                     _regions[VitNX_DockArea.Right].Size = region.Size;
                     break;

                 case VitNX_DockArea.Bottom:
                     _regions[VitNX_DockArea.Bottom].Size = region.Size;
                     break;
             }
             foreach (var group in region.Groups)
             {
                 VitNX_DockContent previousContent = null;
                 VitNX_DockContent visibleContent = null;
                 foreach (var contentKey in group.Contents)
                 {
                     var content = getContentBySerializationKey(contentKey);
                     if (content == null)
                         continue;
                     content.DockArea = region.Area;
                     if (previousContent == null)
                         AddContent(content);
                     else
                         AddContent(content, previousContent.DockGroup);
                     previousContent = content;
                     if (group.VisibleContent == contentKey)
                         visibleContent = content;
                 }
                 if (visibleContent != null)
                     visibleContent.Select();
             }
         }
     }

    This language is not supported or no code example is available.

Applies to

#### .NET Framework

Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8

#### .NET Core

Supported in: 5.0+, 6.0+
See Also
VitNX_DockPanel Class
VitNX.UI.ControlsV1.Docking Namespace