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

Made fixed size behavior in OnFixChildrenDockLengths optional. #1195

Open
wants to merge 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected override void OnFixChildrenDockLengths()
for (int i = 0; i < _model.Children.Count; i++)
{
var childModel = _model.Children[i] as ILayoutPositionableElement;
if (!childModel.DockWidth.IsStar)
if (childModel.ForceFixedDockSize && !childModel.DockWidth.IsStar)
{
childModel.DockWidth = new GridLength(1.0, GridUnitType.Star);
}
Expand All @@ -54,7 +54,7 @@ protected override void OnFixChildrenDockLengths()
for (int i = 0; i < _model.Children.Count; i++)
{
var childModel = _model.Children[i] as ILayoutPositionableElement;
if (!childModel.DockHeight.IsStar)
if (childModel.ForceFixedDockSize && !childModel.DockHeight.IsStar)
{
childModel.DockHeight = new GridLength(1.0, GridUnitType.Star);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected override void OnFixChildrenDockLengths()
for (int i = 0; i < _model.Children.Count; i++)
{
var childModel = _model.Children[i] as ILayoutPositionableElement;
if (!childModel.DockWidth.IsStar)
if (childModel.ForceFixedDockSize && !childModel.DockWidth.IsStar)
{
childModel.DockWidth = new GridLength(1.0, GridUnitType.Star);
}
Expand All @@ -53,7 +53,7 @@ protected override void OnFixChildrenDockLengths()
for (int i = 0; i < _model.Children.Count; i++)
{
var childModel = _model.Children[i] as ILayoutPositionableElement;
if (!childModel.DockHeight.IsStar)
if (childModel.ForceFixedDockSize && !childModel.DockHeight.IsStar)
{
childModel.DockHeight = new GridLength(1.0, GridUnitType.Star);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,24 @@ protected override void OnFixChildrenDockLengths()
var childContainerModel = _model.Children[i] as ILayoutContainer;
var childPositionableModel = _model.Children[i] as ILayoutPositionableElement;

if (childContainerModel != null &&
(childContainerModel.IsOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>() ||
childContainerModel.ContainsChildOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>()))
if (childPositionableModel.ForceFixedDockSize)
{
childPositionableModel.DockWidth = new GridLength(1.0, GridUnitType.Star);
}
else if (childPositionableModel != null && childPositionableModel.DockWidth.IsStar)
{
var childPositionableModelWidthActualSize = childPositionableModel as ILayoutPositionableElementWithActualSize;

var widthToSet = Math.Max(childPositionableModelWidthActualSize.ActualWidth, childPositionableModel.DockMinWidth);

widthToSet = Math.Min(widthToSet, ActualWidth / 2.0);
widthToSet = Math.Max(widthToSet, childPositionableModel.DockMinWidth);

childPositionableModel.DockWidth = new GridLength(
widthToSet,
GridUnitType.Pixel);
if (childContainerModel != null &&
(childContainerModel.IsOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>() ||
childContainerModel.ContainsChildOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>())) {
childPositionableModel.DockWidth = new GridLength(1.0, GridUnitType.Star);
} else if (childPositionableModel != null && childPositionableModel.DockWidth.IsStar) {
var childPositionableModelWidthActualSize = childPositionableModel as ILayoutPositionableElementWithActualSize;

var widthToSet = Math.Max(childPositionableModelWidthActualSize.ActualWidth, childPositionableModel.DockMinWidth);

widthToSet = Math.Min(widthToSet, ActualWidth / 2.0);
widthToSet = Math.Max(widthToSet, childPositionableModel.DockMinWidth);

childPositionableModel.DockWidth = new GridLength(
widthToSet,
GridUnitType.Pixel);
}
}
}
}
Expand All @@ -78,7 +78,7 @@ protected override void OnFixChildrenDockLengths()
for (int i = 0; i < _model.Children.Count; i++)
{
var childPositionableModel = _model.Children[i] as ILayoutPositionableElement;
if (!childPositionableModel.DockWidth.IsStar)
if (childPositionableModel.ForceFixedDockSize && !childPositionableModel.DockWidth.IsStar)
{
childPositionableModel.DockWidth = new GridLength(1.0, GridUnitType.Star);
}
Expand All @@ -94,21 +94,21 @@ protected override void OnFixChildrenDockLengths()
var childContainerModel = _model.Children[i] as ILayoutContainer;
var childPositionableModel = _model.Children[i] as ILayoutPositionableElement;

if (childContainerModel != null &&
(childContainerModel.IsOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>() ||
childContainerModel.ContainsChildOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>()))
if (childPositionableModel.ForceFixedDockSize)
{
childPositionableModel.DockHeight = new GridLength(1.0, GridUnitType.Star);
}
else if (childPositionableModel != null && childPositionableModel.DockHeight.IsStar)
{
var childPositionableModelWidthActualSize = childPositionableModel as ILayoutPositionableElementWithActualSize;

var heightToSet = Math.Max(childPositionableModelWidthActualSize.ActualHeight, childPositionableModel.DockMinHeight);
heightToSet = Math.Min(heightToSet, ActualHeight / 2.0);
heightToSet = Math.Max(heightToSet, childPositionableModel.DockMinHeight);

childPositionableModel.DockHeight = new GridLength(heightToSet, GridUnitType.Pixel);
if (childContainerModel != null &&
(childContainerModel.IsOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>() ||
childContainerModel.ContainsChildOfType<LayoutDocumentPane, LayoutDocumentPaneGroup>())) {
childPositionableModel.DockHeight = new GridLength(1.0, GridUnitType.Star);
} else if (childPositionableModel != null && childPositionableModel.DockHeight.IsStar) {
var childPositionableModelWidthActualSize = childPositionableModel as ILayoutPositionableElementWithActualSize;

var heightToSet = Math.Max(childPositionableModelWidthActualSize.ActualHeight, childPositionableModel.DockMinHeight);
heightToSet = Math.Min(heightToSet, ActualHeight / 2.0);
heightToSet = Math.Max(heightToSet, childPositionableModel.DockMinHeight);

childPositionableModel.DockHeight = new GridLength(heightToSet, GridUnitType.Pixel);
}
}
}
}
Expand All @@ -117,7 +117,7 @@ protected override void OnFixChildrenDockLengths()
for (int i = 0; i < _model.Children.Count; i++)
{
var childPositionableModel = _model.Children[i] as ILayoutPositionableElement;
if (!childPositionableModel.DockHeight.IsStar)
if (childPositionableModel.ForceFixedDockSize && !childPositionableModel.DockHeight.IsStar)
{
childPositionableModel.DockHeight = new GridLength(1.0, GridUnitType.Star);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ GridLength DockHeight
bool AllowDuplicateContent { get; set; }

bool IsVisible { get; }
bool ForceFixedDockSize { get; }
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,29 @@ public GridLength DockHeight
}

protected virtual void OnDockHeightChanged()
{
{

}

bool _forceFixedDockSize;
public bool ForceFixedDockSize
{
get {
return _forceFixedDockSize;
}
set {
if (ForceFixedDockSize != value) {
RaisePropertyChanging("ForceFixedDockSize");
_forceFixedDockSize = value;
RaisePropertyChanging("ForceFixedDockSize");

OnForceFixedDockSizeChanged();
}
}
}

protected virtual void OnForceFixedDockSizeChanged()
{

}

Expand Down