Skip to content

Commit

Permalink
Merge pull request #99 from scdmitryvodich/HideEmptyFloatingWindow
Browse files Browse the repository at this point in the history
Resolve #98 with floating window without a content
  • Loading branch information
Dirkster99 authored Dec 10, 2019
2 parents a54b7d5 + 50f5951 commit 119db6a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow mo
{
root.Updated += OnRootUpdated;
}

_model.IsVisibleChanged += _model_IsVisibleChanged;
}

private void OnRootUpdated(object sender, EventArgs e)
Expand Down Expand Up @@ -194,6 +196,7 @@ protected override void OnClosed(EventArgs e)
BindingOperations.ClearBinding(_model, VisibilityProperty);

_model.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(_model_PropertyChanged);
_model.IsVisibleChanged -= _model_IsVisibleChanged;
Activated -= LayoutAnchorableFloatingWindowControl_Activated;
IsVisibleChanged -= this.LayoutAnchorableFloatingWindowControl_IsVisibleChanged;
BindingOperations.ClearBinding(this, VisibilityProperty);
Expand Down Expand Up @@ -285,6 +288,14 @@ private void _model_PropertyChanged(object sender, System.ComponentModel.Propert
}
}

private void _model_IsVisibleChanged(object sender, EventArgs e)
{
if (!this.IsVisible && _model.IsVisible)
{
this.Show();
}
}

private void CreateOverlayWindow()
{
if (_overlayWindow == null)
Expand Down
23 changes: 20 additions & 3 deletions source/Components/Xceed.Wpf.AvalonDock/DockingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,17 @@ protected virtual void OnLayoutChanged(LayoutRoot oldLayout, LayoutRoot newLayou
fw.WindowState = WindowState.Maximized;
}
else
fw.Show();
{
if (fw.Content != null || (fw.Model as LayoutAnchorableFloatingWindow)?.IsVisible == true)
{
fw.Show();
}
else
{
fw.Hide();
}
}

//fw.Owner = Window.GetWindow(this);
//fw.SetParentToMainWindowOf(this);
}
Expand Down Expand Up @@ -2100,8 +2110,15 @@ internal UIElement CreateUIElementForModel(ILayoutElement model)

Dispatcher.BeginInvoke(new Action(() =>
{
newFW.Show();
}), DispatcherPriority.Send);
if (newFW.Content != null || (newFW.Model as LayoutAnchorableFloatingWindow)?.IsVisible == true)
{
newFW.Show();
}
else
{
newFW.Hide();
}
}), DispatcherPriority.Send);

if (panegroup != null && panegroup.IsMaximized)
{
Expand Down

0 comments on commit 119db6a

Please sign in to comment.