Skip to content

Commit

Permalink
Making Tools>Properties binding of Visibility property work in Layout…
Browse files Browse the repository at this point in the history
…Anchorable for docking in DocumentPane.
  • Loading branch information
Dirkster99 committed Apr 8, 2020
1 parent f9a226f commit 73d0bd2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions source/Components/AvalonDock/Controls/LayoutGridControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,21 @@ protected override void OnInitialized(EventArgs e)

#region Internal Methods

/// <summary>
/// Method is invoked to invoke custom code when all children are updated
/// towards the size they can occupy in the available space of the Grid control.
/// </summary>
protected void FixChildrenDockLengths()
{
using (_fixingChildrenDockLengths.Enter())
OnFixChildrenDockLengths();
}

/// <summary>
/// This method provides an opportunity for deriving classes to invoke custom when
/// all children of this Grid are update towards the size
/// they can occupy in the available space of the Grid control.
/// </summary>
protected abstract void OnFixChildrenDockLengths();

#endregion
Expand Down Expand Up @@ -130,6 +139,11 @@ private void OnUnloaded(object sender, RoutedEventArgs e)
Unloaded -= OnUnloaded;
}

/// <summary>
/// Is invoked to update all children towards the size they can occupy in the available space
/// of the Grid control. This includes detaching/attaching all relevant event handlers and
/// property bindings.
/// </summary>
private void UpdateChildren()
{
var alreadyContainedChildren = Children.OfType<ILayoutControl>().ToArray();
Expand Down Expand Up @@ -189,6 +203,10 @@ private void OnChildModelPropertyChanged(object sender, System.ComponentModel.Pr
UpdateRowColDefinitions();
}

/// <summary>
/// Is invoked to update column and row definitions towards the available size
/// when processing resize events or application start-up.
/// </summary>
private void UpdateRowColDefinitions()
{
var root = _model.Root;
Expand Down
4 changes: 4 additions & 0 deletions source/Components/AvalonDock/Layout/LayoutAnchorable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,11 @@ internal void CloseAnchorable()
{
if (!TestCanClose()) return;
if (IsAutoHidden) ToggleAutoHide();

RaisePropertyChanging(nameof(IsVisible));
CloseInternal();
IsVisible = false;
RaisePropertyChanged(nameof(IsVisible));
}

internal void SetCanCloseInternal(bool canClose)
Expand Down

0 comments on commit 73d0bd2

Please sign in to comment.