When every pane but one is dragged out of a DockManagerSplitPane, the DockManager removes the split pane and moves the remaining pane up into the split pane's parent. That pane keeps its Size, but the size was relative to the removed split pane's orientation.
If the removed split pane was vertical and its parent is horizontal, the remaining pane's height percentage becomes its width percentage. In the example below, Pane A is 80% of the left column's height. After Pane B is dragged out, Pane A becomes 80% of the whole DockManager's width.
The same happens with split panes the DockManager creates while you drag. Docking a pane above or below Pane A creates a vertical split where each pane gets 50%. Dragging that pane out again leaves Pane A at 50% of the DockManager's width.
The wrong size is also in the state returned by GetState() and OnStateChanged, so a saved layout keeps it too.
Steps to reproduce (scenario 1)
Run the page below.
Drag "Pane B" out of the left column and dock it in the center (for example to the right of "Editor"), or float it.
Click "Show state".
Expected: Pane A takes the place of the removed left split pane at that pane's width (20%).
Actual: Pane A becomes 80% of the DockManager's width, and its Size in the state is still 80%.
Steps to reproduce (scenario 2)
After scenario 1, drag "Preview" and dock it below "Pane A". The DockManager creates a vertical split and gives both panes 50%.
Drag "Preview" out again and dock it to the right of "Editor".
Expected: Pane A gets the width of the removed split pane.
Actual: Pane A becomes 50% of the DockManager's width.
Suggested fix: when a split pane is removed and its last child moves up into the split pane's parent, give that child the removed split pane's Size.
Test Page:
@using System.Text.Json
<TelerikButton OnClick="@ShowState">Show state</TelerikButton>
<TelerikDockManager @ref="_dockManager" Height="600px" OnStateChanged="@OnStateChanged">
<DockManagerPanes>
<DockManagerSplitPane Orientation="@DockManagerPaneOrientation.Horizontal" @bind-Size="@LeftSplitPaneSize">
<Panes>
<DockManagerSplitPane Id="left-split" Orientation="@DockManagerPaneOrientation.Vertical">
<Panes>
<DockManagerContentPane Id="pane-a" HeaderText="Pane A" @bind-Size="@PaneASize">
<Content>Pane A - 80% of the left column's height</Content>
</DockManagerContentPane>
<DockManagerContentPane Id="pane-b" HeaderText="Pane B" @bind-Size="@PaneBSize">
<Content>Pane B - drag me out of the left column</Content>
</DockManagerContentPane>
</Panes>
</DockManagerSplitPane>
<DockManagerContentPane Id="editor" HeaderText="Editor" @bind-Size="@EditorPaneSize">
<Content>Editor</Content>
</DockManagerContentPane>
<DockManagerContentPane Id="preview" HeaderText="Preview" @bind-Size="@PreviewPaneSize">
<Content>Preview</Content>
</DockManagerContentPane>
</Panes>
</DockManagerSplitPane>
</DockManagerPanes>
</TelerikDockManager>
<pre>@_stateJson</pre>
@code {
private string EditorPaneSize { get; set; } = "40%";
private string PreviewPaneSize { get; set; } = "40%";
private string LeftSplitPaneSize { get; set; } = "20%";
private string PaneASize { get; set; } = "80%";
private string PaneBSize { get; set; } = "20%";
private TelerikDockManager _dockManager = default!;
private string _stateJson = string.Empty;
private void OnStateChanged(DockManagerStateEventArgs args)
{
_stateJson = Serialize(args.DockManagerState);
}
private void ShowState()
{
_stateJson = Serialize(_dockManager.GetState());
}
private static string Serialize(DockManagerState state)
{
return JsonSerializer.Serialize(state, new JsonSerializerOptions { WriteIndented = true });
}
}