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

The minimum sizes of the floating window are made on the basis of ... #58

Merged
Merged
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 @@ -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 @@ -146,6 +163,12 @@ protected override void OnClosed( EventArgs e )
var root = Model.Root;
if( root != null )
{
LayoutRoot layoutRoot = root as LayoutRoot;
if (layoutRoot != null)
{
layoutRoot.Updated -= OnRootUpdated;
}

root.Manager.RemoveFloatingWindow( this );
root.CollectGarbage();
}
Expand Down Expand Up @@ -228,10 +251,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