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

fix_issue_473 #474

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion source/Components/AvalonDock/Controls/LayoutPanelControl.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/************************************************************************
/************************************************************************
AvalonDock

Copyright (C) 2007-2013 Xceed Software Inc.
Expand All @@ -9,6 +9,7 @@ This program is provided to you under the terms of the Microsoft Public

using AvalonDock.Layout;
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;

Expand Down Expand Up @@ -61,6 +62,23 @@ protected override void OnFixChildrenDockLengths()
{
var childPositionableModelWidthActualSize = _model.Children[i] as ILayoutPositionableElement as ILayoutPositionableElementWithActualSize;
var childDockMinWidth = (_model.Children[i] as ILayoutPositionableElement).CalculatedDockMinWidth();
if (childPositionableModelWidthActualSize.ActualWidth == 0)
{
if (childPositionableModelWidthActualSize.DockWidth.IsStar)
{
childPositionableModelWidthActualSize.ActualWidth = (ActualWidth - _model.Children.Cast<ILayoutPositionableElement>()
.Where(j => j.DockWidth.IsAbsolute)
.Select(j => j.DockWidth.Value)
.Sum()) * childPositionableModelWidthActualSize.DockWidth.Value / _model.Children.Cast<ILayoutPositionableElement>()
.Where(j => j.DockWidth.IsStar)
.Select(j => j.DockWidth.Value)
.Sum();
}
else if (childPositionableModelWidthActualSize.DockWidth.IsAbsolute)
{
childPositionableModelWidthActualSize.ActualWidth = childPositionableModelWidthActualSize.DockWidth.Value;
}
}
var widthToSet = Math.Max(childPositionableModelWidthActualSize.ActualWidth, childDockMinWidth);

widthToSet = Math.Min(widthToSet, ActualWidth / 2.0);
Expand Down Expand Up @@ -99,6 +117,23 @@ protected override void OnFixChildrenDockLengths()
{
var childPositionableModelWidthActualSize = _model.Children[i] as ILayoutPositionableElement as ILayoutPositionableElementWithActualSize;
var childDockMinHeight = (_model.Children[i] as ILayoutPositionableElement).CalculatedDockMinHeight();
if (childPositionableModelWidthActualSize.ActualHeight == 0)
{
if (childPositionableModelWidthActualSize.DockHeight.IsStar)
{
childPositionableModelWidthActualSize.ActualHeight = ((ActualHeight - _model.Children.Cast<ILayoutPositionableElement>()
.Where(j => j.DockHeight.IsAbsolute)
.Select(j => j.DockHeight.Value)
.Sum())) * childPositionableModelWidthActualSize.DockHeight.Value / _model.Children.Cast<ILayoutPositionableElement>()
.Where(j => j.DockHeight.IsStar)
.Select(j => j.DockHeight.Value)
.Sum();
}
else if (childPositionableModelWidthActualSize.DockHeight.IsAbsolute)
{
childPositionableModelWidthActualSize.ActualHeight = childPositionableModelWidthActualSize.DockHeight.Value;
}
}
var heightToSet = Math.Max(childPositionableModelWidthActualSize.ActualHeight, childDockMinHeight);
heightToSet = Math.Min(heightToSet, ActualHeight / 2.0);
heightToSet = Math.Max(heightToSet, childDockMinHeight);
Expand Down
Loading