Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default width and height of LayoutAnchorable #327

Merged
merged 2 commits into from
Feb 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 45 additions & 8 deletions source/Components/AvalonDock/Layout/LayoutAnchorable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,20 @@ public void ToggleAutoHide()
case AnchorSide.Right:
if (parentGroup.Root.RootPanel.Orientation == Orientation.Horizontal)
{
previousContainer = new LayoutAnchorablePane { DockMinWidth = AutoHideMinWidth };
previousContainer = new LayoutAnchorablePane
{
DockMinWidth = AutoHideMinWidth,
DockMinHeight = AutoHideMinHeight
};
parentGroup.Root.RootPanel.Children.Add(previousContainer);
}
else
{
previousContainer = new LayoutAnchorablePane();
previousContainer = new LayoutAnchorablePane
{
DockMinHeight = AutoHideMinHeight,
DockMinWidth = AutoHideMinWidth
};
var panel = new LayoutPanel { Orientation = Orientation.Horizontal };
var root = parentGroup.Root as LayoutRoot;
var oldRootPanel = parentGroup.Root.RootPanel;
Expand All @@ -460,12 +468,20 @@ public void ToggleAutoHide()
case AnchorSide.Left:
if (parentGroup.Root.RootPanel.Orientation == Orientation.Horizontal)
{
previousContainer = new LayoutAnchorablePane { DockMinWidth = AutoHideMinWidth };
previousContainer = new LayoutAnchorablePane
{
DockMinWidth = AutoHideMinWidth,
DockMinHeight = AutoHideMinHeight
};
parentGroup.Root.RootPanel.Children.Insert(0, previousContainer);
}
else
{
previousContainer = new LayoutAnchorablePane();
previousContainer = new LayoutAnchorablePane
{
DockMinHeight = AutoHideMinHeight,
DockMinWidth = AutoHideMinWidth
};
var panel = new LayoutPanel { Orientation = Orientation.Horizontal };
var root = parentGroup.Root as LayoutRoot;
var oldRootPanel = parentGroup.Root.RootPanel;
Expand All @@ -478,12 +494,20 @@ public void ToggleAutoHide()
case AnchorSide.Top:
if (parentGroup.Root.RootPanel.Orientation == Orientation.Vertical)
{
previousContainer = new LayoutAnchorablePane { DockMinHeight = AutoHideMinHeight };
previousContainer = new LayoutAnchorablePane
{
DockMinHeight = AutoHideMinHeight,
DockMinWidth = AutoHideMinWidth
};
parentGroup.Root.RootPanel.Children.Insert(0, previousContainer);
}
else
{
previousContainer = new LayoutAnchorablePane();
previousContainer = new LayoutAnchorablePane
{
DockMinWidth = AutoHideMinWidth,
DockMinHeight = AutoHideMinHeight
};
var panel = new LayoutPanel { Orientation = Orientation.Vertical };
var root = parentGroup.Root as LayoutRoot;
var oldRootPanel = parentGroup.Root.RootPanel;
Expand All @@ -498,13 +522,18 @@ public void ToggleAutoHide()
{
previousContainer = new LayoutAnchorablePane
{
DockMinHeight = AutoHideMinHeight
DockMinHeight = AutoHideMinHeight,
DockMinWidth = AutoHideMinWidth
};
parentGroup.Root.RootPanel.Children.Add(previousContainer);
}
else
{
previousContainer = new LayoutAnchorablePane();
previousContainer = new LayoutAnchorablePane
{
DockMinWidth = AutoHideMinWidth,
DockMinHeight = AutoHideMinHeight
};
var panel = new LayoutPanel { Orientation = Orientation.Vertical };
var root = parentGroup.Root as LayoutRoot;
var oldRootPanel = parentGroup.Root.RootPanel;
Expand All @@ -524,9 +553,17 @@ public void ToggleAutoHide()
cnt.PreviousContainer = previousContainer;
}

var selectedIndex = -1;
var selectedItem = parentGroup.Children.FirstOrDefault(x => x.IsActive);
if (selectedItem != null)
selectedIndex = parentGroup.Children.IndexOf(selectedItem);

foreach (var anchorableToToggle in parentGroup.Children.ToArray())
previousContainer.Children.Add(anchorableToToggle);

if (selectedIndex != -1)
previousContainer.SelectedContentIndex = selectedIndex;

parentSide.Children.Remove(parentGroup);

var parent = previousContainer.Parent as LayoutGroupBase;
Expand Down