Skip to content

Commit

Permalink
The minimum sizes of the floating window are made on the basis of Doc…
Browse files Browse the repository at this point in the history
…kMinSizes children. Fix showing floating window again if it was hidden by cross button
  • Loading branch information
scdmitryvodich committed Jul 31, 2019
1 parent 1fcf21f commit c025edb
Showing 1 changed file with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ internal LayoutAnchorableFloatingWindowControl( LayoutAnchorableFloatingWindow m
HideWindowCommand = new RelayCommand( ( p ) => OnExecuteHideWindowCommand( p ), ( p ) => CanExecuteHideWindowCommand( p ) );
CloseWindowCommand = new RelayCommand( ( p ) => OnExecuteCloseWindowCommand( p ), ( p ) => CanExecuteCloseWindowCommand( p ) );
UpdateThemeResources();
MinWidth = _model.RootPanel.CalculatedDockMinWidth();
MinHeight = _model.RootPanel.CalculatedDockMinHeight();

LayoutRoot root = _model.Root as LayoutRoot;
if (root != null)
{
root.Updated += OnRootUpdated;
}
}

private void OnRootUpdated(object sender, EventArgs e)
{
if (_model?.RootPanel != null)
{
MinWidth = _model.RootPanel.CalculatedDockMinWidth();
MinHeight = _model.RootPanel.CalculatedDockMinHeight();
}
}

internal LayoutAnchorableFloatingWindowControl( LayoutAnchorableFloatingWindow model)
Expand Down Expand Up @@ -228,10 +245,23 @@ internal override void UpdateThemeResources( Xceed.Wpf.AvalonDock.Themes.Theme o

private void _model_PropertyChanged( object sender, System.ComponentModel.PropertyChangedEventArgs e )
{
if( e.PropertyName == "RootPanel" &&
_model.RootPanel == null )
switch (e.PropertyName)
{
InternalClose();
case "RootPanel":
if (_model.RootPanel == null)
{
InternalClose();
}

break;

case "IsVisible":
if (_model.IsVisible != IsVisible)
{
Visibility = _model.IsVisible ? Visibility.Visible : Visibility.Hidden;
}

break;
}
}

Expand Down

0 comments on commit c025edb

Please sign in to comment.