From f1707f61dbe2489c4805d08a565b2242fb11b63d Mon Sep 17 00:00:00 2001 From: Boris Dachev Date: Mon, 17 Aug 2020 11:43:42 +0300 Subject: [PATCH 1/2] Remove SetCanCloseInternal/ResetCanCloseInternal ... ... and modify XAML in themes to react on CanClose = false and CanHide = true and use HideCommand instead of Close Command --- .../AvalonDock.Themes.Aero/Theme.xaml | 17 ++++++++++-- .../AvalonDock.Themes.Expression/Theme.xaml | 17 ++++++++++-- .../AvalonDock.Themes.Metro/Theme.xaml | 17 ++++++++++-- .../AvalonDock.Themes.VS2010/Theme.xaml | 17 ++++++++++-- .../Themes/Generic.xaml | 19 +++++++++++--- .../Controls/DocumentPaneDropTarget.cs | 5 ++-- .../Controls/DocumentPaneGroupDropTarget.cs | 5 ++-- .../Controls/LayoutDocumentTabItem.cs | 5 ++-- .../AvalonDock/Layout/LayoutAnchorable.cs | 26 ++++++++++--------- .../Components/AvalonDock/Themes/generic.xaml | 17 ++++++++++-- 10 files changed, 114 insertions(+), 31 deletions(-) diff --git a/source/Components/AvalonDock.Themes.Aero/Theme.xaml b/source/Components/AvalonDock.Themes.Aero/Theme.xaml index b43c692b..a7bc8113 100644 --- a/source/Components/AvalonDock.Themes.Aero/Theme.xaml +++ b/source/Components/AvalonDock.Themes.Aero/Theme.xaml @@ -1059,9 +1059,22 @@ - + + + + + + + + + + + + + + - + diff --git a/source/Components/AvalonDock.Themes.Expression/Theme.xaml b/source/Components/AvalonDock.Themes.Expression/Theme.xaml index a1b9d481..a3c0ecb7 100644 --- a/source/Components/AvalonDock.Themes.Expression/Theme.xaml +++ b/source/Components/AvalonDock.Themes.Expression/Theme.xaml @@ -926,9 +926,22 @@ - + + + + + + + + + + + + + + - + diff --git a/source/Components/AvalonDock.Themes.Metro/Theme.xaml b/source/Components/AvalonDock.Themes.Metro/Theme.xaml index 824b13db..c14d0304 100644 --- a/source/Components/AvalonDock.Themes.Metro/Theme.xaml +++ b/source/Components/AvalonDock.Themes.Metro/Theme.xaml @@ -1088,9 +1088,22 @@ - + + + + + + + + + + + + + + - + diff --git a/source/Components/AvalonDock.Themes.VS2010/Theme.xaml b/source/Components/AvalonDock.Themes.VS2010/Theme.xaml index da0ca4ba..5470b798 100644 --- a/source/Components/AvalonDock.Themes.VS2010/Theme.xaml +++ b/source/Components/AvalonDock.Themes.VS2010/Theme.xaml @@ -1134,9 +1134,22 @@ - + + + + + + + + + + + + + + - + diff --git a/source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml b/source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml index 7e96258e..a85da551 100644 --- a/source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml +++ b/source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml @@ -1,4 +1,4 @@ - + + + + + + + + + + + + + - + diff --git a/source/Components/AvalonDock/Controls/DocumentPaneDropTarget.cs b/source/Components/AvalonDock/Controls/DocumentPaneDropTarget.cs index d5dfa2eb..3878e0a9 100644 --- a/source/Components/AvalonDock/Controls/DocumentPaneDropTarget.cs +++ b/source/Components/AvalonDock/Controls/DocumentPaneDropTarget.cs @@ -506,7 +506,8 @@ protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) checkPreviousContainer = false; } - anchorableToImport.SetCanCloseInternal(true); + // BD: 17.08.2020 Remove that bodge and handle CanClose=false && CanHide=true in XAML + //anchorableToImport.SetCanCloseInternal(true); paneModel.Children.Insert(i, anchorableToImport); i++; @@ -606,4 +607,4 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, #endregion Overrides } -} \ No newline at end of file +} diff --git a/source/Components/AvalonDock/Controls/DocumentPaneGroupDropTarget.cs b/source/Components/AvalonDock/Controls/DocumentPaneGroupDropTarget.cs index df164a40..988235e3 100644 --- a/source/Components/AvalonDock/Controls/DocumentPaneGroupDropTarget.cs +++ b/source/Components/AvalonDock/Controls/DocumentPaneGroupDropTarget.cs @@ -99,7 +99,8 @@ protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) int i = 0; foreach (var anchorableToImport in layoutAnchorablePaneGroup.Descendents().OfType().ToArray()) { - anchorableToImport.SetCanCloseInternal(true); + // BD: 18.07.2020 Remove that bodge and handle CanClose=false && CanHide=true in XAML + //anchorableToImport.SetCanCloseInternal(true); paneModel.Children.Insert(i, anchorableToImport); i++; @@ -145,4 +146,4 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, #endregion Overrides } -} \ No newline at end of file +} diff --git a/source/Components/AvalonDock/Controls/LayoutDocumentTabItem.cs b/source/Components/AvalonDock/Controls/LayoutDocumentTabItem.cs index 972e8882..34437e05 100644 --- a/source/Components/AvalonDock/Controls/LayoutDocumentTabItem.cs +++ b/source/Components/AvalonDock/Controls/LayoutDocumentTabItem.cs @@ -210,11 +210,12 @@ private void UpdateDragDetails() private void StartDraggingFloatingWindowForContent() { ReleaseMouseCapture(); - if (Model is LayoutAnchorable layoutAnchorable) layoutAnchorable.ResetCanCloseInternal(); + // BD: 17.08.2020 Remove that bodge and handle CanClose=false && CanHide=true in XAML + //if (Model is LayoutAnchorable layoutAnchorable) layoutAnchorable.ResetCanCloseInternal(); var manager = Model.Root.Manager; manager.StartDraggingFloatingWindowForContent(Model); } #endregion Private Methods } -} \ No newline at end of file +} diff --git a/source/Components/AvalonDock/Layout/LayoutAnchorable.cs b/source/Components/AvalonDock/Layout/LayoutAnchorable.cs index 60eef8ad..e12eae04 100644 --- a/source/Components/AvalonDock/Layout/LayoutAnchorable.cs +++ b/source/Components/AvalonDock/Layout/LayoutAnchorable.cs @@ -1,4 +1,4 @@ -/************************************************************************ +/************************************************************************ AvalonDock Copyright (C) 2007-2013 Xceed Software Inc. @@ -34,7 +34,8 @@ public class LayoutAnchorable : LayoutContent private bool _canHide = true; private bool _canAutoHide = true; private bool _canDockAsTabbedDocument = true; - private bool _canCloseValueBeforeInternalSet; + // BD: 17.08.2020 Remove that bodge and handle CanClose=false && CanHide=true in XAML + //private bool _canCloseValueBeforeInternalSet; private bool _canMove = true; #endregion fields @@ -575,16 +576,17 @@ internal void CloseAnchorable() CloseInternal(); } - internal void SetCanCloseInternal(bool canClose) - { - _canCloseValueBeforeInternalSet = _canClose; - _canClose = canClose; - } + // BD: 17.08.2020 Remove that bodge and handle CanClose=false && CanHide=true in XAML + //internal void SetCanCloseInternal(bool canClose) + //{ + // _canCloseValueBeforeInternalSet = _canClose; + // _canClose = canClose; + //} - internal void ResetCanCloseInternal() - { - _canClose = _canCloseValueBeforeInternalSet; - } + //internal void ResetCanCloseInternal() + //{ + // _canClose = _canCloseValueBeforeInternalSet; + //} #endregion Internal Methods @@ -608,4 +610,4 @@ private void UpdateParentVisibility() #endregion Private Methods } -} \ No newline at end of file +} diff --git a/source/Components/AvalonDock/Themes/generic.xaml b/source/Components/AvalonDock/Themes/generic.xaml index 7b640fd4..fdd761bc 100644 --- a/source/Components/AvalonDock/Themes/generic.xaml +++ b/source/Components/AvalonDock/Themes/generic.xaml @@ -799,9 +799,22 @@ - + + + + + + + + + + + + + + - + From e1381ae5bc74e603387ee4a84e497facd681cdc1 Mon Sep 17 00:00:00 2001 From: Boris Dachev Date: Thu, 20 Aug 2020 18:45:09 +0300 Subject: [PATCH 2/2] Changed also button's tool-tip from Close to Hide --- source/Components/AvalonDock.Themes.Aero/Theme.xaml | 3 ++- source/Components/AvalonDock.Themes.Expression/Theme.xaml | 3 ++- source/Components/AvalonDock.Themes.Metro/Theme.xaml | 3 ++- source/Components/AvalonDock.Themes.VS2010/Theme.xaml | 3 ++- source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml | 3 ++- source/Components/AvalonDock/Themes/generic.xaml | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/source/Components/AvalonDock.Themes.Aero/Theme.xaml b/source/Components/AvalonDock.Themes.Aero/Theme.xaml index a7bc8113..fed8315c 100644 --- a/source/Components/AvalonDock.Themes.Aero/Theme.xaml +++ b/source/Components/AvalonDock.Themes.Aero/Theme.xaml @@ -1,4 +1,4 @@ - diff --git a/source/Components/AvalonDock.Themes.Expression/Theme.xaml b/source/Components/AvalonDock.Themes.Expression/Theme.xaml index a3c0ecb7..64dcec6c 100644 --- a/source/Components/AvalonDock.Themes.Expression/Theme.xaml +++ b/source/Components/AvalonDock.Themes.Expression/Theme.xaml @@ -1,4 +1,4 @@ - diff --git a/source/Components/AvalonDock.Themes.Metro/Theme.xaml b/source/Components/AvalonDock.Themes.Metro/Theme.xaml index c14d0304..3347af52 100644 --- a/source/Components/AvalonDock.Themes.Metro/Theme.xaml +++ b/source/Components/AvalonDock.Themes.Metro/Theme.xaml @@ -1,4 +1,4 @@ - diff --git a/source/Components/AvalonDock.Themes.VS2010/Theme.xaml b/source/Components/AvalonDock.Themes.VS2010/Theme.xaml index 5470b798..191d3aae 100644 --- a/source/Components/AvalonDock.Themes.VS2010/Theme.xaml +++ b/source/Components/AvalonDock.Themes.VS2010/Theme.xaml @@ -1,4 +1,4 @@ - diff --git a/source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml b/source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml index a85da551..07837993 100644 --- a/source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml +++ b/source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml @@ -1,4 +1,4 @@ - diff --git a/source/Components/AvalonDock/Themes/generic.xaml b/source/Components/AvalonDock/Themes/generic.xaml index fdd761bc..b958e806 100644 --- a/source/Components/AvalonDock/Themes/generic.xaml +++ b/source/Components/AvalonDock/Themes/generic.xaml @@ -1,4 +1,4 @@ -