From c025edb9654e12d2fddc07e835fa3f336839d02e Mon Sep 17 00:00:00 2001 From: Dmitry Vodich Date: Wed, 31 Jul 2019 15:20:49 +0300 Subject: [PATCH] The minimum sizes of the floating window are made on the basis of DockMinSizes children. Fix showing floating window again if it was hidden by cross button --- .../LayoutAnchorableFloatingWindowControl.cs | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableFloatingWindowControl.cs b/source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableFloatingWindowControl.cs index 1bbfc83c..8ef90c46 100644 --- a/source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableFloatingWindowControl.cs +++ b/source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableFloatingWindowControl.cs @@ -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) @@ -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; } }