Skip to content

Commit

Permalink
Resolve #98 with floating window without a content shown as black rec…
Browse files Browse the repository at this point in the history
…tangle
  • Loading branch information
scdmitryvodich committed Dec 5, 2019
1 parent a54b7d5 commit 50f5951
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 50f5951

Please sign in to comment.