diff --git a/AvalonDockIcon.design b/AvalonDockIcon.design
new file mode 100644
index 00000000..058d74aa
Binary files /dev/null and b/AvalonDockIcon.design differ
diff --git a/source/.editorconfig b/source/.editorconfig
new file mode 100644
index 00000000..16da0401
--- /dev/null
+++ b/source/.editorconfig
@@ -0,0 +1,4 @@
+[*.cs]
+
+# IDE0055: 修正格式
+dotnet_diagnostic.IDE0055.severity = none
diff --git a/source/Components/AvalonDock.Themes.Aero/Properties/AssemblyInfo.cs b/source/Components/AvalonDock.Themes.Aero/Properties/AssemblyInfo.cs
index 979eadc9..cd5334c6 100644
--- a/source/Components/AvalonDock.Themes.Aero/Properties/AssemblyInfo.cs
+++ b/source/Components/AvalonDock.Themes.Aero/Properties/AssemblyInfo.cs
@@ -38,4 +38,6 @@ This program is provided to you under the terms of the Microsoft Public
)]
-[assembly: XmlnsDefinition("https://github.com/Dirkster99/AvalonDock", "AvalonDock.Themes")]
\ No newline at end of file
+[assembly: XmlnsDefinition("https://github.com/Dirkster99/AvalonDock", "AvalonDock.Themes")]
+[assembly: XmlnsPrefix("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "AvalonDock.Themes")]
+[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "AvalonDock.Themes")]
\ No newline at end of file
diff --git a/source/Components/AvalonDock.Themes.Aero/Theme.xaml b/source/Components/AvalonDock.Themes.Aero/Theme.xaml
index d9bf9ada..da765898 100644
--- a/source/Components/AvalonDock.Themes.Aero/Theme.xaml
+++ b/source/Components/AvalonDock.Themes.Aero/Theme.xaml
@@ -1,1548 +1,1538 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/Components/AvalonDock.Themes.Expression/Properties/AssemblyInfo.cs b/source/Components/AvalonDock.Themes.Expression/Properties/AssemblyInfo.cs
index 3c724777..ec11e47e 100644
--- a/source/Components/AvalonDock.Themes.Expression/Properties/AssemblyInfo.cs
+++ b/source/Components/AvalonDock.Themes.Expression/Properties/AssemblyInfo.cs
@@ -39,3 +39,5 @@ This program is provided to you under the terms of the Microsoft Public
[assembly: XmlnsDefinition("https://github.com/Dirkster99/AvalonDock", "AvalonDock.Themes")]
+[assembly: XmlnsPrefix("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "AvalonDock.Themes")]
+[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "AvalonDock.Themes")]
diff --git a/source/Components/AvalonDock.Themes.Expression/Theme.xaml b/source/Components/AvalonDock.Themes.Expression/Theme.xaml
index 42199afb..35d9ea8d 100644
--- a/source/Components/AvalonDock.Themes.Expression/Theme.xaml
+++ b/source/Components/AvalonDock.Themes.Expression/Theme.xaml
@@ -1,1613 +1,1603 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/Components/AvalonDock.Themes.Metro/Properties/AssemblyInfo.cs b/source/Components/AvalonDock.Themes.Metro/Properties/AssemblyInfo.cs
index 3c724777..ec11e47e 100644
--- a/source/Components/AvalonDock.Themes.Metro/Properties/AssemblyInfo.cs
+++ b/source/Components/AvalonDock.Themes.Metro/Properties/AssemblyInfo.cs
@@ -39,3 +39,5 @@ This program is provided to you under the terms of the Microsoft Public
[assembly: XmlnsDefinition("https://github.com/Dirkster99/AvalonDock", "AvalonDock.Themes")]
+[assembly: XmlnsPrefix("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "AvalonDock.Themes")]
+[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "AvalonDock.Themes")]
diff --git a/source/Components/AvalonDock.Themes.Metro/Theme.xaml b/source/Components/AvalonDock.Themes.Metro/Theme.xaml
index ad197d86..e2055c5e 100644
--- a/source/Components/AvalonDock.Themes.Metro/Theme.xaml
+++ b/source/Components/AvalonDock.Themes.Metro/Theme.xaml
@@ -1,1596 +1,1586 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/Components/AvalonDock.Themes.VS2010/Properties/AssemblyInfo.cs b/source/Components/AvalonDock.Themes.VS2010/Properties/AssemblyInfo.cs
index 3c724777..ec11e47e 100644
--- a/source/Components/AvalonDock.Themes.VS2010/Properties/AssemblyInfo.cs
+++ b/source/Components/AvalonDock.Themes.VS2010/Properties/AssemblyInfo.cs
@@ -39,3 +39,5 @@ This program is provided to you under the terms of the Microsoft Public
[assembly: XmlnsDefinition("https://github.com/Dirkster99/AvalonDock", "AvalonDock.Themes")]
+[assembly: XmlnsPrefix("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "AvalonDock.Themes")]
+[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "AvalonDock.Themes")]
diff --git a/source/Components/AvalonDock.Themes.VS2010/Theme.xaml b/source/Components/AvalonDock.Themes.VS2010/Theme.xaml
index 665109ba..80d8c07a 100644
--- a/source/Components/AvalonDock.Themes.VS2010/Theme.xaml
+++ b/source/Components/AvalonDock.Themes.VS2010/Theme.xaml
@@ -1,1629 +1,1618 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/Components/AvalonDock.Themes.VS2013/DarkBrushs.xaml b/source/Components/AvalonDock.Themes.VS2013/DarkBrushs.xaml
index 2711d9fc..383f246a 100644
--- a/source/Components/AvalonDock.Themes.VS2013/DarkBrushs.xaml
+++ b/source/Components/AvalonDock.Themes.VS2013/DarkBrushs.xaml
@@ -1,429 +1,429 @@
-
-
-
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
+ xmlns:reskeys="clr-namespace:AvalonDock.Themes.VS2013.Themes">
+
+
+
-
- #1ba1e2
+
+ #FF007ACC
-
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockAnchorableBottom.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockAnchorableBottom.png
deleted file mode 100644
index a786a61f..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockAnchorableBottom.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockAnchorableLeft.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockAnchorableLeft.png
deleted file mode 100644
index 1499c434..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockAnchorableLeft.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockAnchorableRight.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockAnchorableRight.png
deleted file mode 100644
index e6802ba3..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockAnchorableRight.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockAnchorableTop.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockAnchorableTop.png
deleted file mode 100644
index cd79f578..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockAnchorableTop.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentAsAnchorableBottom.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentAsAnchorableBottom.png
deleted file mode 100644
index 00436bba..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentAsAnchorableBottom.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentAsAnchorableLeft.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentAsAnchorableLeft.png
deleted file mode 100644
index 6500b08c..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentAsAnchorableLeft.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentAsAnchorableRight.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentAsAnchorableRight.png
deleted file mode 100644
index a71a8c50..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentAsAnchorableRight.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentAsAnchorableTop.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentAsAnchorableTop.png
deleted file mode 100644
index 2ac77654..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentAsAnchorableTop.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentBottom.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentBottom.png
deleted file mode 100644
index c5bed349..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentBottom.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentInside.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentInside.png
deleted file mode 100644
index 038ac8b3..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentInside.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentLeft.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentLeft.png
deleted file mode 100644
index d77a43f2..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentLeft.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentRight.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentRight.png
deleted file mode 100644
index 83322201..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentRight.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentTop.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentTop.png
deleted file mode 100644
index f8e075d9..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockDocumentTop.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockPaneEmpty.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockPaneEmpty.png
deleted file mode 100644
index 8ad11767..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockPaneEmpty.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/DockPaneLargeEmpty.png b/source/Components/AvalonDock.Themes.VS2013/Images/DockPaneLargeEmpty.png
deleted file mode 100644
index 8205a034..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/DockPaneLargeEmpty.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/HTabGroup.png b/source/Components/AvalonDock.Themes.VS2013/Images/HTabGroup.png
deleted file mode 100644
index 4c50d26d..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/HTabGroup.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/Locked.png b/source/Components/AvalonDock.Themes.VS2013/Images/Locked.png
deleted file mode 100644
index b8f6ced2..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/Locked.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinAutoHide.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinAutoHide.png
deleted file mode 100644
index abefd96b..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinAutoHide.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinAutoHide_Black.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinAutoHide_Black.png
deleted file mode 100644
index 87b66ced..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinAutoHide_Black.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinAutoHide_Dark.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinAutoHide_Dark.png
deleted file mode 100644
index 470548dc..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinAutoHide_Dark.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinAutoHide_White.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinAutoHide_White.png
deleted file mode 100644
index 3ef7f338..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinAutoHide_White.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinClose.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinClose.png
deleted file mode 100644
index 132bdfaf..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinClose.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinClose_Black.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinClose_Black.png
deleted file mode 100644
index abf709cb..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinClose_Black.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinClose_Dark.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinClose_Dark.png
deleted file mode 100644
index 575e4fdb..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinClose_Dark.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinClose_White.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinClose_White.png
deleted file mode 100644
index 662933b9..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinClose_White.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinDocMenu.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinDocMenu.png
deleted file mode 100644
index 86db3070..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinDocMenu.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinDocMenu_Black.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinDocMenu_Black.png
deleted file mode 100644
index be081925..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinDocMenu_Black.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinMaximize.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinMaximize.png
deleted file mode 100644
index 79d8c2d0..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinMaximize.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinMaximize_Black.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinMaximize_Black.png
deleted file mode 100644
index 42ae679a..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinMaximize_Black.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinMaximize_Dark.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinMaximize_Dark.png
deleted file mode 100644
index e28e0607..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinMaximize_Dark.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinMenu.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinMenu.png
deleted file mode 100644
index 653373ce..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinMenu.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinMenu_Black.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinMenu_Black.png
deleted file mode 100644
index 31e2f102..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinMenu_Black.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinMenu_Dark.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinMenu_Dark.png
deleted file mode 100644
index 25a47678..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinMenu_Dark.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinMenu_White.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinMenu_White.png
deleted file mode 100644
index ffe5e0e8..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinMenu_White.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinRestore.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinRestore.png
deleted file mode 100644
index 1bccead4..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinRestore.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinRestore_Black.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinRestore_Black.png
deleted file mode 100644
index 7c7e0032..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinRestore_Black.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/PinRestore_Dark.png b/source/Components/AvalonDock.Themes.VS2013/Images/PinRestore_Dark.png
deleted file mode 100644
index f3ebfe4c..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/PinRestore_Dark.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/Images/VTabGroup.png b/source/Components/AvalonDock.Themes.VS2013/Images/VTabGroup.png
deleted file mode 100644
index c3f279f7..00000000
Binary files a/source/Components/AvalonDock.Themes.VS2013/Images/VTabGroup.png and /dev/null differ
diff --git a/source/Components/AvalonDock.Themes.VS2013/OverlayButtons.xaml b/source/Components/AvalonDock.Themes.VS2013/OverlayButtons.xaml
index 7c55a32f..523d5662 100644
--- a/source/Components/AvalonDock.Themes.VS2013/OverlayButtons.xaml
+++ b/source/Components/AvalonDock.Themes.VS2013/OverlayButtons.xaml
@@ -1,649 +1,582 @@
-
-
-
-
- 48
- 48
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:reskeys="clr-namespace:AvalonDock.Themes.VS2013.Themes"
+ xmlns:sys="clr-namespace:System;assembly=mscorlib">
+
+
+
+
+ 40
+ 40
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/Components/AvalonDock.Themes.VS2013/Properties/AssemblyInfo.cs b/source/Components/AvalonDock.Themes.VS2013/Properties/AssemblyInfo.cs
index 3c724777..cd5334c6 100644
--- a/source/Components/AvalonDock.Themes.VS2013/Properties/AssemblyInfo.cs
+++ b/source/Components/AvalonDock.Themes.VS2013/Properties/AssemblyInfo.cs
@@ -39,3 +39,5 @@ This program is provided to you under the terms of the Microsoft Public
[assembly: XmlnsDefinition("https://github.com/Dirkster99/AvalonDock", "AvalonDock.Themes")]
+[assembly: XmlnsPrefix("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "AvalonDock.Themes")]
+[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "AvalonDock.Themes")]
\ No newline at end of file
diff --git a/source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml b/source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml
index 58db40d6..8fb1ed23 100644
--- a/source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml
+++ b/source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml
@@ -1,2368 +1,2287 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/Components/AvalonDock.Themes.VS2013/Themes/Icons/IconGeometry.xaml b/source/Components/AvalonDock.Themes.VS2013/Themes/Icons/IconGeometry.xaml
new file mode 100644
index 00000000..ee5acde2
--- /dev/null
+++ b/source/Components/AvalonDock.Themes.VS2013/Themes/Icons/IconGeometry.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/Components/AvalonDock.Themes.VS2013/Themes/Menu/MenuItem.xaml b/source/Components/AvalonDock.Themes.VS2013/Themes/Menu/MenuItem.xaml
index 5eea8be2..b9980c3d 100644
--- a/source/Components/AvalonDock.Themes.VS2013/Themes/Menu/MenuItem.xaml
+++ b/source/Components/AvalonDock.Themes.VS2013/Themes/Menu/MenuItem.xaml
@@ -1,108 +1,135 @@
-
+
-
-
+
+
M 0,5.1 L 1.7,5.2 L 3.4,7.1 L 8,0.4 L 9.2,0 L 3.3,10.8 Z
-
-
+
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+ VerticalAlignment="Center"
+ Data="M0,0 L0,8 L4,4 z"
+ Fill="{TemplateBinding Foreground}" />
-
+
-
-
-
-
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
\ No newline at end of file
diff --git a/source/Components/AvalonDock/Controls/DropDownControlArea.cs b/source/Components/AvalonDock/Controls/DropDownControlArea.cs
index 5c1fc16d..ea310385 100644
--- a/source/Components/AvalonDock/Controls/DropDownControlArea.cs
+++ b/source/Components/AvalonDock/Controls/DropDownControlArea.cs
@@ -21,8 +21,8 @@ namespace AvalonDock.Controls
///
/// The content is usually displayed via ContentPresenter binding in the theme definition.
///
- ///
- public class DropDownControlArea : UserControl
+ ///
+ public class DropDownControlArea : ContentControl
{
#region Properties
diff --git a/source/Components/AvalonDock/Controls/LayoutAnchorableItem.cs b/source/Components/AvalonDock/Controls/LayoutAnchorableItem.cs
index 70a0d2d4..e281aba9 100644
--- a/source/Components/AvalonDock/Controls/LayoutAnchorableItem.cs
+++ b/source/Components/AvalonDock/Controls/LayoutAnchorableItem.cs
@@ -16,287 +16,287 @@ This program is provided to you under the terms of the Microsoft Public
namespace AvalonDock.Controls
{
- ///
- ///
- /// This is a wrapper for around the custom anchorable content view of .
- /// Implements the
- ///
- /// All DPs implemented here can be bound in a corresponding style to control parameters
- /// in dependency properties via binding in MVVM.
- ///
- ///
- public class LayoutAnchorableItem : LayoutItem
- {
- #region fields
- private LayoutAnchorable _anchorable; // The content of this item
- private ICommand _defaultHideCommand;
- private ICommand _defaultAutoHideCommand;
- private ICommand _defaultDockCommand;
- private ReentrantFlag _visibilityReentrantFlag = new ReentrantFlag();
- private ReentrantFlag _anchorableVisibilityReentrantFlag = new ReentrantFlag();
- #endregion fields
-
- #region Constructors
- /// Class constructor
- internal LayoutAnchorableItem()
- {
- }
- #endregion Constructors
-
- #region Properties
-
- #region HideCommand
-
- /// dependency property.
- public static readonly DependencyProperty HideCommandProperty = DependencyProperty.Register(nameof(HideCommand), typeof(ICommand), typeof(LayoutAnchorableItem),
- new FrameworkPropertyMetadata(null, OnHideCommandChanged, CoerceHideCommandValue));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates the command to execute when an anchorable is hidden.
- ///
- public ICommand HideCommand
- {
- get => (ICommand)GetValue(HideCommandProperty);
- set => SetValue(HideCommandProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnHideCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((LayoutAnchorableItem)d).OnHideCommandChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnHideCommandChanged(DependencyPropertyChangedEventArgs e)
- {
- }
-
- /// Coerces the value.
- private static object CoerceHideCommandValue(DependencyObject d, object value) => value;
-
- private bool CanExecuteHideCommand(object parameter) => LayoutElement != null && _anchorable.CanHide;
-
- private void ExecuteHideCommand(object parameter) => _anchorable?.Root?.Manager?._ExecuteHideCommand(_anchorable);
-
- #endregion HideCommand
-
- #region AutoHideCommand
-
- /// dependency property.
- public static readonly DependencyProperty AutoHideCommandProperty = DependencyProperty.Register(nameof(AutoHideCommand), typeof(ICommand), typeof(LayoutAnchorableItem),
- new FrameworkPropertyMetadata(null, OnAutoHideCommandChanged, CoerceAutoHideCommandValue));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates the command to execute when user click the auto hide button.
- ///
- /// By default this command toggles auto hide state for an anchorable.
- public ICommand AutoHideCommand
- {
- get => (ICommand)GetValue(AutoHideCommandProperty);
- set => SetValue(AutoHideCommandProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnAutoHideCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((LayoutAnchorableItem)d).OnAutoHideCommandChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnAutoHideCommandChanged(DependencyPropertyChangedEventArgs e)
- {
- }
-
- /// Coerces the value.
- private static object CoerceAutoHideCommandValue(DependencyObject d, object value) => value;
-
- private bool CanExecuteAutoHideCommand(object parameter)
- {
- if (LayoutElement == null) return false;
- if (LayoutElement.FindParent() != null) return false;//is floating
- return _anchorable.CanAutoHide;
- }
-
- private void ExecuteAutoHideCommand(object parameter) => _anchorable?.Root?.Manager?._ExecuteAutoHideCommand(_anchorable);
-
- #endregion AutoHideCommand
-
- #region DockCommand
-
- /// dependency property.
- public static readonly DependencyProperty DockCommandProperty = DependencyProperty.Register(nameof(DockCommand), typeof(ICommand), typeof(LayoutAnchorableItem),
- new FrameworkPropertyMetadata(null, OnDockCommandChanged, CoerceDockCommandValue));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates the command to execute when user click the Dock button.
- ///
- /// By default this command moves the anchorable inside the container pane which previously hosted the object.
- public ICommand DockCommand
- {
- get => (ICommand)GetValue(DockCommandProperty);
- set => SetValue(DockCommandProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnDockCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((LayoutAnchorableItem)d).OnDockCommandChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnDockCommandChanged(DependencyPropertyChangedEventArgs e)
- {
- }
-
- /// Coerces the value.
- private static object CoerceDockCommandValue(DependencyObject d, object value) => value;
-
- private bool CanExecuteDockCommand(object parameter) => LayoutElement?.FindParent() != null;
-
- private void ExecuteDockCommand(object parameter) => LayoutElement.Root.Manager._ExecuteDockCommand(_anchorable);
-
- #endregion DockCommand
-
- #region CanHide
-
- /// dependency property.
- public static readonly DependencyProperty CanHideProperty = DependencyProperty.Register(nameof(CanHide), typeof(bool), typeof(LayoutAnchorableItem), new FrameworkPropertyMetadata((bool)true,
- OnCanHideChanged));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates if user can hide the anchorable item.
- ///
- public bool CanHide
- {
- get => (bool)GetValue(CanHideProperty);
- set => SetValue(CanHideProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnCanHideChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((LayoutAnchorableItem)d).OnCanHideChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnCanHideChanged(DependencyPropertyChangedEventArgs e)
- {
- if (_anchorable != null) _anchorable.CanHide = (bool)e.NewValue;
- }
-
- #endregion CanHide
-
- #region CanMove
-
- /// dependency property.
- public static readonly DependencyProperty CanMoveProperty = DependencyProperty.Register(nameof(CanMove), typeof(bool), typeof(LayoutAnchorableItem), new FrameworkPropertyMetadata((bool)true,
- OnCanMoveChanged));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates if user can hide the anchorable item.
- ///
- public bool CanMove
- {
- get => (bool)GetValue(CanMoveProperty);
- set => SetValue(CanMoveProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnCanMoveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((LayoutAnchorableItem)d).OnCanHideChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnCanMoveChanged(DependencyPropertyChangedEventArgs e)
- {
- if (_anchorable != null) _anchorable.CanMove = (bool)e.NewValue;
- }
-
- #endregion CanMove
-
- #endregion Properties
-
- #region Overrides
-
- internal override void Attach(LayoutContent model)
- {
- _anchorable = model as LayoutAnchorable;
- _anchorable.IsVisibleChanged += _anchorable_IsVisibleChanged;
- base.Attach(model);
- }
-
- internal override void Detach()
- {
- _anchorable.IsVisibleChanged -= _anchorable_IsVisibleChanged;
- _anchorable = null;
- base.Detach();
- }
-
- ///
- protected override bool CanExecuteDockAsDocumentCommand()
- {
- var canExecute = base.CanExecuteDockAsDocumentCommand();
- if (canExecute && _anchorable != null) return _anchorable.CanDockAsTabbedDocument;
- return canExecute;
- }
-
- ///
- protected override void Close()
- {
- if (_anchorable.Root?.Manager == null) return;
- var dockingManager = _anchorable.Root.Manager;
- dockingManager._ExecuteCloseCommand(_anchorable);
- }
-
- ///
- protected override void InitDefaultCommands()
- {
- _defaultHideCommand = new RelayCommand(ExecuteHideCommand, CanExecuteHideCommand);
- _defaultAutoHideCommand = new RelayCommand(ExecuteAutoHideCommand, CanExecuteAutoHideCommand);
- _defaultDockCommand = new RelayCommand(ExecuteDockCommand, CanExecuteDockCommand);
- base.InitDefaultCommands();
- }
-
- ///
- protected override void ClearDefaultBindings()
- {
- if (HideCommand == _defaultHideCommand) BindingOperations.ClearBinding(this, HideCommandProperty);
- if (AutoHideCommand == _defaultAutoHideCommand) BindingOperations.ClearBinding(this, AutoHideCommandProperty);
- if (DockCommand == _defaultDockCommand) BindingOperations.ClearBinding(this, DockCommandProperty);
- base.ClearDefaultBindings();
- }
-
- ///
- protected override void SetDefaultBindings()
- {
- if (HideCommand == null) HideCommand = _defaultHideCommand;
- if (AutoHideCommand == null) AutoHideCommand = _defaultAutoHideCommand;
- if (DockCommand == null) DockCommand = _defaultDockCommand;
- Visibility = _anchorable.IsVisible ? Visibility.Visible : Visibility.Hidden;
- base.SetDefaultBindings();
- }
-
- ///
- protected override void OnVisibilityChanged()
- {
- if (_anchorable?.Root != null && _visibilityReentrantFlag.CanEnter)
- {
- using (_visibilityReentrantFlag.Enter())
- {
- switch (Visibility)
- {
- case Visibility.Hidden: _anchorable.Hide(false); break;
- case Visibility.Visible: _anchorable.Show(); break;
- }
- }
- }
- base.OnVisibilityChanged();
- }
-
- #endregion Overrides
-
- #region Private Methods
-
- private void _anchorable_IsVisibleChanged(object sender, EventArgs e)
- {
- if (_anchorable?.Root == null || !_anchorableVisibilityReentrantFlag.CanEnter) return;
- using (_anchorableVisibilityReentrantFlag.Enter())
- {
- Visibility = _anchorable.IsVisible ? Visibility.Visible : Visibility.Hidden;
- }
- }
-
- #endregion Private Methods
- }
+ ///
+ ///
+ /// This is a wrapper for around the custom anchorable content view of .
+ /// Implements the
+ ///
+ /// All DPs implemented here can be bound in a corresponding style to control parameters
+ /// in dependency properties via binding in MVVM.
+ ///
+ ///
+ public class LayoutAnchorableItem : LayoutItem
+ {
+ #region fields
+ private LayoutAnchorable _anchorable; // The content of this item
+ private ICommand _defaultHideCommand;
+ private ICommand _defaultAutoHideCommand;
+ private ICommand _defaultDockCommand;
+ private readonly ReentrantFlag _visibilityReentrantFlag = new ReentrantFlag();
+ private readonly ReentrantFlag _anchorableVisibilityReentrantFlag = new ReentrantFlag();
+ #endregion fields
+
+ #region Constructors
+ /// Class constructor
+ internal LayoutAnchorableItem()
+ {
+ }
+ #endregion Constructors
+
+ #region Properties
+
+ #region HideCommand
+
+ /// dependency property.
+ public static readonly DependencyProperty HideCommandProperty = DependencyProperty.Register(nameof(HideCommand), typeof(ICommand), typeof(LayoutAnchorableItem),
+ new FrameworkPropertyMetadata(null, OnHideCommandChanged, CoerceHideCommandValue));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates the command to execute when an anchorable is hidden.
+ ///
+ public ICommand HideCommand
+ {
+ get => (ICommand)GetValue(HideCommandProperty);
+ set => SetValue(HideCommandProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnHideCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((LayoutAnchorableItem)d).OnHideCommandChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnHideCommandChanged(DependencyPropertyChangedEventArgs e)
+ {
+ }
+
+ /// Coerces the value.
+ private static object CoerceHideCommandValue(DependencyObject d, object value) => value;
+
+ private bool CanExecuteHideCommand(object parameter) => LayoutElement != null && _anchorable.CanHide;
+
+ private void ExecuteHideCommand(object parameter) => _anchorable?.Root?.Manager?.ExecuteHideCommand(_anchorable);
+
+ #endregion HideCommand
+
+ #region AutoHideCommand
+
+ /// dependency property.
+ public static readonly DependencyProperty AutoHideCommandProperty = DependencyProperty.Register(nameof(AutoHideCommand), typeof(ICommand), typeof(LayoutAnchorableItem),
+ new FrameworkPropertyMetadata(null, OnAutoHideCommandChanged, CoerceAutoHideCommandValue));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates the command to execute when user click the auto hide button.
+ ///
+ /// By default this command toggles auto hide state for an anchorable.
+ public ICommand AutoHideCommand
+ {
+ get => (ICommand)GetValue(AutoHideCommandProperty);
+ set => SetValue(AutoHideCommandProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnAutoHideCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((LayoutAnchorableItem)d).OnAutoHideCommandChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnAutoHideCommandChanged(DependencyPropertyChangedEventArgs e)
+ {
+ }
+
+ /// Coerces the value.
+ private static object CoerceAutoHideCommandValue(DependencyObject d, object value) => value;
+
+ private bool CanExecuteAutoHideCommand(object parameter)
+ {
+ if (LayoutElement == null) return false;
+ if (LayoutElement.FindParent() != null) return false;//is floating
+ return _anchorable.CanAutoHide;
+ }
+
+ private void ExecuteAutoHideCommand(object parameter) => _anchorable?.Root?.Manager?.ExecuteAutoHideCommand(_anchorable);
+
+ #endregion AutoHideCommand
+
+ #region DockCommand
+
+ /// dependency property.
+ public static readonly DependencyProperty DockCommandProperty = DependencyProperty.Register(nameof(DockCommand), typeof(ICommand), typeof(LayoutAnchorableItem),
+ new FrameworkPropertyMetadata(null, OnDockCommandChanged, CoerceDockCommandValue));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates the command to execute when user click the Dock button.
+ ///
+ /// By default this command moves the anchorable inside the container pane which previously hosted the object.
+ public ICommand DockCommand
+ {
+ get => (ICommand)GetValue(DockCommandProperty);
+ set => SetValue(DockCommandProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnDockCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((LayoutAnchorableItem)d).OnDockCommandChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnDockCommandChanged(DependencyPropertyChangedEventArgs e)
+ {
+ }
+
+ /// Coerces the value.
+ private static object CoerceDockCommandValue(DependencyObject d, object value) => value;
+
+ private bool CanExecuteDockCommand(object parameter) => LayoutElement?.FindParent() != null;
+
+ private void ExecuteDockCommand(object parameter) => LayoutElement.Root.Manager.ExecuteDockCommand(_anchorable);
+
+ #endregion DockCommand
+
+ #region CanHide
+
+ /// dependency property.
+ public static readonly DependencyProperty CanHideProperty = DependencyProperty.Register(nameof(CanHide), typeof(bool), typeof(LayoutAnchorableItem), new FrameworkPropertyMetadata((bool)true,
+ OnCanHideChanged));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates if user can hide the anchorable item.
+ ///
+ public bool CanHide
+ {
+ get => (bool)GetValue(CanHideProperty);
+ set => SetValue(CanHideProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnCanHideChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((LayoutAnchorableItem)d).OnCanHideChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnCanHideChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (_anchorable != null) _anchorable.CanHide = (bool)e.NewValue;
+ }
+
+ #endregion CanHide
+
+ #region CanMove
+
+ /// dependency property.
+ public static readonly DependencyProperty CanMoveProperty = DependencyProperty.Register(nameof(CanMove), typeof(bool), typeof(LayoutAnchorableItem), new FrameworkPropertyMetadata((bool)true,
+ OnCanMoveChanged));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates if user can hide the anchorable item.
+ ///
+ public bool CanMove
+ {
+ get => (bool)GetValue(CanMoveProperty);
+ set => SetValue(CanMoveProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnCanMoveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((LayoutAnchorableItem)d).OnCanHideChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnCanMoveChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (_anchorable != null) _anchorable.CanMove = (bool)e.NewValue;
+ }
+
+ #endregion CanMove
+
+ #endregion Properties
+
+ #region Overrides
+
+ internal override void Attach(LayoutContent model)
+ {
+ _anchorable = model as LayoutAnchorable;
+ _anchorable.IsVisibleChanged += _anchorable_IsVisibleChanged;
+ base.Attach(model);
+ }
+
+ internal override void Detach()
+ {
+ _anchorable.IsVisibleChanged -= _anchorable_IsVisibleChanged;
+ _anchorable = null;
+ base.Detach();
+ }
+
+ ///
+ protected override bool CanExecuteDockAsDocumentCommand()
+ {
+ var canExecute = base.CanExecuteDockAsDocumentCommand();
+ if (canExecute && _anchorable != null) return _anchorable.CanDockAsTabbedDocument;
+ return canExecute;
+ }
+
+ ///
+ protected override void Close()
+ {
+ if (_anchorable.Root?.Manager == null) return;
+ var dockingManager = _anchorable.Root.Manager;
+ dockingManager.ExecuteCloseCommand(_anchorable);
+ }
+
+ ///
+ protected override void InitDefaultCommands()
+ {
+ _defaultHideCommand = new RelayCommand(ExecuteHideCommand, CanExecuteHideCommand);
+ _defaultAutoHideCommand = new RelayCommand(ExecuteAutoHideCommand, CanExecuteAutoHideCommand);
+ _defaultDockCommand = new RelayCommand(ExecuteDockCommand, CanExecuteDockCommand);
+ base.InitDefaultCommands();
+ }
+
+ ///
+ protected override void ClearDefaultBindings()
+ {
+ if (HideCommand == _defaultHideCommand) BindingOperations.ClearBinding(this, HideCommandProperty);
+ if (AutoHideCommand == _defaultAutoHideCommand) BindingOperations.ClearBinding(this, AutoHideCommandProperty);
+ if (DockCommand == _defaultDockCommand) BindingOperations.ClearBinding(this, DockCommandProperty);
+ base.ClearDefaultBindings();
+ }
+
+ ///
+ protected override void SetDefaultBindings()
+ {
+ if (HideCommand == null) HideCommand = _defaultHideCommand;
+ if (AutoHideCommand == null) AutoHideCommand = _defaultAutoHideCommand;
+ if (DockCommand == null) DockCommand = _defaultDockCommand;
+ Visibility = _anchorable.IsVisible ? Visibility.Visible : Visibility.Hidden;
+ base.SetDefaultBindings();
+ }
+
+ ///
+ protected override void OnVisibilityChanged()
+ {
+ if (_anchorable?.Root != null && _visibilityReentrantFlag.CanEnter)
+ {
+ using (_visibilityReentrantFlag.Enter())
+ {
+ switch (Visibility)
+ {
+ case Visibility.Hidden: case Visibility.Collapsed: _anchorable.Hide(false); break;
+ case Visibility.Visible: _anchorable.Show(); break;
+ }
+ }
+ }
+ base.OnVisibilityChanged();
+ }
+
+ #endregion Overrides
+
+ #region Private Methods
+
+ private void _anchorable_IsVisibleChanged(object sender, EventArgs e)
+ {
+ if (_anchorable?.Root == null || !_anchorableVisibilityReentrantFlag.CanEnter) return;
+ using (_anchorableVisibilityReentrantFlag.Enter())
+ {
+ Visibility = _anchorable.IsVisible ? Visibility.Visible : Visibility.Hidden;
+ }
+ }
+
+ #endregion Private Methods
+ }
}
diff --git a/source/Components/AvalonDock/Controls/LayoutDocumentControl.cs b/source/Components/AvalonDock/Controls/LayoutDocumentControl.cs
index f30c0422..8785b157 100644
--- a/source/Components/AvalonDock/Controls/LayoutDocumentControl.cs
+++ b/source/Components/AvalonDock/Controls/LayoutDocumentControl.cs
@@ -134,7 +134,7 @@ protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
private void SetIsActive()
{
- if (Model != null) Model.IsActive = true;
+ if (Model != null && !Model.IsActive) Model.IsActive = true;
}
#endregion Private Methods
diff --git a/source/Components/AvalonDock/Controls/LayoutDocumentFloatingWindowControl.cs b/source/Components/AvalonDock/Controls/LayoutDocumentFloatingWindowControl.cs
index 28dc53f4..40b488e6 100644
--- a/source/Components/AvalonDock/Controls/LayoutDocumentFloatingWindowControl.cs
+++ b/source/Components/AvalonDock/Controls/LayoutDocumentFloatingWindowControl.cs
@@ -26,8 +26,8 @@ namespace AvalonDock.Controls
///
public class LayoutDocumentFloatingWindowControl : LayoutFloatingWindowControl, IOverlayWindowHost
{
- #region fields
- private LayoutDocumentFloatingWindow _model;
+ #region fields
+ private readonly LayoutDocumentFloatingWindow _model;
private List _dropAreas = null;
#endregion fields
@@ -105,7 +105,7 @@ protected override void OnInitialized(EventArgs e)
_model.RootPanel.ChildrenCollectionChanged += RootPanelOnChildrenCollectionChanged;
}
- void _model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+ void Model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(LayoutDocumentFloatingWindow.RootPanel) && _model.RootPanel == null) InternalClose();
}
@@ -159,7 +159,7 @@ protected override void OnClosed(EventArgs e)
}
base.OnClosed(e);
if (!CloseInitiatedByUser) root?.FloatingWindows.Remove(_model);
- _model.PropertyChanged -= _model_PropertyChanged;
+ _model.PropertyChanged -= Model_PropertyChanged;
}
#endregion
@@ -240,7 +240,7 @@ public IEnumerable GetDropAreas(LayoutFloatingWindowControl draggingW
var dockAsDocument = true;
if (!isDraggingDocuments)
{
- if (draggingWindow.Model is LayoutAnchorableFloatingWindow toolWindow)
+ if (draggingWindow.Model is LayoutAnchorableFloatingWindow)
{
foreach (var item in GetAnchorableInFloatingWindow(draggingWindow))
{
@@ -277,18 +277,17 @@ public IEnumerable GetDropAreas(LayoutFloatingWindowControl draggingW
private IEnumerable GetAnchorableInFloatingWindow(LayoutFloatingWindowControl draggingWindow)
{
if (!(draggingWindow.Model is LayoutAnchorableFloatingWindow layoutAnchorableFloatingWindow)) yield break;
- //big part of code for getting type
- var layoutAnchorablePane = layoutAnchorableFloatingWindow.SinglePane as LayoutAnchorablePane;
-
- if (layoutAnchorablePane != null && (layoutAnchorableFloatingWindow.IsSinglePane && layoutAnchorablePane.SelectedContent != null))
- {
- var layoutAnchorable = ((LayoutAnchorablePane)layoutAnchorableFloatingWindow.SinglePane).SelectedContent as LayoutAnchorable;
- yield return layoutAnchorable;
- }
- else
- foreach (var item in GetLayoutAnchorable(layoutAnchorableFloatingWindow.RootPanel))
- yield return item;
- }
+ //big part of code for getting type
+
+ if (layoutAnchorableFloatingWindow.SinglePane is LayoutAnchorablePane layoutAnchorablePane && (layoutAnchorableFloatingWindow.IsSinglePane && layoutAnchorablePane.SelectedContent != null))
+ {
+ var layoutAnchorable = ((LayoutAnchorablePane)layoutAnchorableFloatingWindow.SinglePane).SelectedContent as LayoutAnchorable;
+ yield return layoutAnchorable;
+ }
+ else
+ foreach (var item in GetLayoutAnchorable(layoutAnchorableFloatingWindow.RootPanel))
+ yield return item;
+ }
///
/// Finds all objects (toolwindows) within a
diff --git a/source/Components/AvalonDock/Controls/LayoutDocumentItem.cs b/source/Components/AvalonDock/Controls/LayoutDocumentItem.cs
index dbaf4d38..34cb0367 100644
--- a/source/Components/AvalonDock/Controls/LayoutDocumentItem.cs
+++ b/source/Components/AvalonDock/Controls/LayoutDocumentItem.cs
@@ -69,7 +69,7 @@ protected override void Close()
{
if (_document.Root?.Manager == null) return;
var dockingManager = _document.Root.Manager;
- dockingManager._ExecuteCloseCommand(_document);
+ dockingManager.ExecuteCloseCommand(_document);
}
///
diff --git a/source/Components/AvalonDock/Controls/LayoutDocumentPaneControl.cs b/source/Components/AvalonDock/Controls/LayoutDocumentPaneControl.cs
index 31e18401..79c52cc4 100644
--- a/source/Components/AvalonDock/Controls/LayoutDocumentPaneControl.cs
+++ b/source/Components/AvalonDock/Controls/LayoutDocumentPaneControl.cs
@@ -69,7 +69,7 @@ internal LayoutDocumentPaneControl(LayoutDocumentPane model, bool isVirtualizing
protected override void OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
- if (!e.Handled && _model.SelectedContent != null)
+ if (!e.Handled && _model.SelectedContent != null && !_model.SelectedContent.IsActive)
_model.SelectedContent.IsActive = true;
}
diff --git a/source/Components/AvalonDock/Controls/LayoutFloatingWindowControl.cs b/source/Components/AvalonDock/Controls/LayoutFloatingWindowControl.cs
index 8383a222..74e48082 100644
--- a/source/Components/AvalonDock/Controls/LayoutFloatingWindowControl.cs
+++ b/source/Components/AvalonDock/Controls/LayoutFloatingWindowControl.cs
@@ -38,7 +38,7 @@ public abstract class LayoutFloatingWindowControl : Window, ILayoutControl
#region fields
private ResourceDictionary currentThemeResourceDictionary; // = null
private bool _isInternalChange; //false
- private ILayoutElement _model;
+ private readonly ILayoutElement _model;
private bool _attachDrag = false;
private HwndSource _hwndSrc;
private HwndSourceHook _hwndSrcHook;
@@ -57,9 +57,10 @@ public abstract class LayoutFloatingWindowControl : Window, ILayoutControl
static LayoutFloatingWindowControl()
{
- ContentProperty.OverrideMetadata(typeof(LayoutFloatingWindowControl), new FrameworkPropertyMetadata(null, null, CoerceContentValue));
AllowsTransparencyProperty.OverrideMetadata(typeof(LayoutFloatingWindowControl), new FrameworkPropertyMetadata(false));
+ ContentProperty.OverrideMetadata(typeof(LayoutFloatingWindowControl), new FrameworkPropertyMetadata(null, null, CoerceContentValue));
ShowInTaskbarProperty.OverrideMetadata(typeof(LayoutFloatingWindowControl), new FrameworkPropertyMetadata(false));
+ WindowStyleProperty.OverrideMetadata(typeof(LayoutFloatingWindowControl), new FrameworkPropertyMetadata(WindowStyle.None));
}
protected LayoutFloatingWindowControl(ILayoutElement model)
@@ -627,7 +628,7 @@ public virtual void DisableBindings()
protected internal class FloatingWindowContentHost : HwndHost
{
#region fields
- private LayoutFloatingWindowControl _owner;
+ private readonly LayoutFloatingWindowControl _owner;
private HwndSource _wpfContentHost = null;
private Border _rootPresenter = null;
private DockingManager _manager = null;
@@ -713,7 +714,8 @@ protected override HandleRef BuildWindowCore(HandleRef hwndParent)
ParentWindow = hwndParent.Handle,
WindowStyle = Win32Helper.WS_CHILD | Win32Helper.WS_VISIBLE | Win32Helper.WS_CLIPSIBLINGS | Win32Helper.WS_CLIPCHILDREN,
Width = 1,
- Height = 1
+ Height = 1,
+ UsesPerPixelOpacity = true,
});
_rootPresenter = new Border { Child = new AdornerDecorator { Child = Content }, Focusable = true };
diff --git a/source/Components/AvalonDock/Controls/LayoutItem.cs b/source/Components/AvalonDock/Controls/LayoutItem.cs
index d9a55d33..608fea73 100644
--- a/source/Components/AvalonDock/Controls/LayoutItem.cs
+++ b/source/Components/AvalonDock/Controls/LayoutItem.cs
@@ -353,7 +353,7 @@ protected virtual void OnFloatCommandChanged(DependencyPropertyChangedEventArgs
/// Executes to float the content of this LayoutItem in a separate .
///
- private void ExecuteFloatCommand(object parameter) => LayoutElement.Root.Manager._ExecuteFloatCommand(LayoutElement);
+ private void ExecuteFloatCommand(object parameter) => LayoutElement.Root.Manager.ExecuteFloatCommand(LayoutElement);
#endregion
@@ -389,7 +389,7 @@ protected virtual void OnDockAsDocumentCommandChanged(DependencyPropertyChangedE
private bool CanExecuteDockAsDocumentCommand(object parameter) => CanExecuteDockAsDocumentCommand();
- private void ExecuteDockAsDocumentCommand(object parameter) => LayoutElement.Root.Manager._ExecuteDockAsDocumentCommand(LayoutElement);
+ private void ExecuteDockAsDocumentCommand(object parameter) => LayoutElement.Root.Manager.ExecuteDockAsDocumentCommand(LayoutElement);
#endregion
@@ -427,7 +427,7 @@ private bool CanExecuteCloseAllButThisCommand(object parameter)
return LayoutElement.Root.Manager.Layout.Descendents().OfType().Any(d => d != LayoutElement && (d.Parent is LayoutDocumentPane || d.Parent is LayoutDocumentFloatingWindow));
}
- private void ExecuteCloseAllButThisCommand(object parameter) => LayoutElement.Root.Manager._ExecuteCloseAllButThisCommand(LayoutElement);
+ private void ExecuteCloseAllButThisCommand(object parameter) => LayoutElement.Root.Manager.ExecuteCloseAllButThisCommand(LayoutElement);
#endregion
@@ -462,7 +462,7 @@ private bool CanExecuteCloseAllCommand(object parameter)
return LayoutElement.Root.Manager.Layout.Descendents().OfType().Any(d => d.Parent is LayoutDocumentPane || d.Parent is LayoutDocumentFloatingWindow);
}
- private void ExecuteCloseAllCommand(object parameter) => LayoutElement.Root.Manager._ExecuteCloseAllCommand(LayoutElement);
+ private void ExecuteCloseAllCommand(object parameter) => LayoutElement.Root.Manager.ExecuteCloseAllCommand(LayoutElement);
#endregion
@@ -495,7 +495,7 @@ protected virtual void OnActivateCommandChanged(DependencyPropertyChangedEventAr
private bool CanExecuteActivateCommand(object parameter) => LayoutElement != null;
- private void ExecuteActivateCommand(object parameter) => LayoutElement.Root.Manager._ExecuteContentActivateCommand(LayoutElement);
+ private void ExecuteActivateCommand(object parameter) => LayoutElement.Root.Manager.ExecuteContentActivateCommand(LayoutElement);
#endregion
diff --git a/source/Components/AvalonDock/Controls/OverlayWindow.cs b/source/Components/AvalonDock/Controls/OverlayWindow.cs
index 9a4d4b51..c8c6c2fb 100644
--- a/source/Components/AvalonDock/Controls/OverlayWindow.cs
+++ b/source/Components/AvalonDock/Controls/OverlayWindow.cs
@@ -68,9 +68,9 @@ public class OverlayWindow : Window, IOverlayWindow
#endregion DocumentPaneFullDropTargets
private Path _previewBox;
- private IOverlayWindowHost _host;
+ private readonly IOverlayWindowHost _host;
private LayoutFloatingWindowControl _floatingWindow = null;
- private List _visibleAreas = new List();
+ private readonly List _visibleAreas = new List();
#endregion fields
#region Constructors
@@ -185,9 +185,9 @@ internal void UpdateThemeResources(Theme oldTheme = null)
if (_host.Manager.Theme != null)
{
- if (_host.Manager.Theme is DictionaryTheme)
+ if (_host.Manager.Theme is DictionaryTheme theme)
{
- currentThemeResourceDictionary = ((DictionaryTheme)_host.Manager.Theme).ThemeResourceDictionary;
+ currentThemeResourceDictionary = theme.ThemeResourceDictionary;
Resources.MergedDictionaries.Add(currentThemeResourceDictionary);
}
else
@@ -275,73 +275,65 @@ private List GetAllLayoutContents(object source)
{
var result = new List();
- var documentFloatingWindow = source as LayoutDocumentFloatingWindow;
- if (documentFloatingWindow != null)
- {
- foreach (var layoutElement in documentFloatingWindow.Children)
- {
- result.AddRange(GetAllLayoutContents(layoutElement));
- }
- }
-
- var anchorableFloatingWindow = source as LayoutAnchorableFloatingWindow;
- if (anchorableFloatingWindow != null)
- {
- foreach (var layoutElement in anchorableFloatingWindow.Children)
- {
- result.AddRange(GetAllLayoutContents(layoutElement));
- }
- }
-
- var documentPaneGroup = source as LayoutDocumentPaneGroup;
- if (documentPaneGroup != null)
- {
- foreach (var layoutDocumentPane in documentPaneGroup.Children)
- {
- result.AddRange(GetAllLayoutContents(layoutDocumentPane));
- }
- }
-
- var anchorablePaneGroup = source as LayoutAnchorablePaneGroup;
- if (anchorablePaneGroup != null)
- {
- foreach (var layoutDocumentPane in anchorablePaneGroup.Children)
- {
- result.AddRange(GetAllLayoutContents(layoutDocumentPane));
- }
- }
-
- var documentPane = source as LayoutDocumentPane;
- if (documentPane != null)
- {
- foreach (var layoutContent in documentPane.Children)
- {
- result.Add(layoutContent);
- }
- }
-
- var anchorablePane = source as LayoutAnchorablePane;
- if (anchorablePane != null)
- {
- foreach (var layoutContent in anchorablePane.Children)
- {
- result.Add(layoutContent);
- }
- }
-
- var document = source as LayoutDocument;
- if (document != null)
- {
- result.Add(document);
- }
-
- var anchorable = source as LayoutAnchorable;
- if (anchorable != null)
- {
- result.Add(anchorable);
- }
-
- return result;
+ if (source is LayoutDocumentFloatingWindow documentFloatingWindow)
+ {
+ foreach (var layoutElement in documentFloatingWindow.Children)
+ {
+ result.AddRange(GetAllLayoutContents(layoutElement));
+ }
+ }
+
+ if (source is LayoutAnchorableFloatingWindow anchorableFloatingWindow)
+ {
+ foreach (var layoutElement in anchorableFloatingWindow.Children)
+ {
+ result.AddRange(GetAllLayoutContents(layoutElement));
+ }
+ }
+
+ if (source is LayoutDocumentPaneGroup documentPaneGroup)
+ {
+ foreach (var layoutDocumentPane in documentPaneGroup.Children)
+ {
+ result.AddRange(GetAllLayoutContents(layoutDocumentPane));
+ }
+ }
+
+ if (source is LayoutAnchorablePaneGroup anchorablePaneGroup)
+ {
+ foreach (var layoutDocumentPane in anchorablePaneGroup.Children)
+ {
+ result.AddRange(GetAllLayoutContents(layoutDocumentPane));
+ }
+ }
+
+ if (source is LayoutDocumentPane documentPane)
+ {
+ foreach (var layoutContent in documentPane.Children)
+ {
+ result.Add(layoutContent);
+ }
+ }
+
+ if (source is LayoutAnchorablePane anchorablePane)
+ {
+ foreach (var layoutContent in anchorablePane.Children)
+ {
+ result.Add(layoutContent);
+ }
+ }
+
+ if (source is LayoutDocument document)
+ {
+ result.Add(document);
+ }
+
+ if (source is LayoutAnchorable anchorable)
+ {
+ result.Add(anchorable);
+ }
+
+ return result;
}
#endregion
diff --git a/source/Components/AvalonDock/Controls/Shell/SystemParameters2.cs b/source/Components/AvalonDock/Controls/Shell/SystemParameters2.cs
index 927649d0..91357fc0 100644
--- a/source/Components/AvalonDock/Controls/Shell/SystemParameters2.cs
+++ b/source/Components/AvalonDock/Controls/Shell/SystemParameters2.cs
@@ -28,7 +28,7 @@ public class SystemParameters2 : INotifyPropertyChanged
private delegate void _SystemMetricUpdate(IntPtr wParam, IntPtr lParam);
[ThreadStatic]
- private static SystemParameters2 _threadLocalSingleton;
+ private static readonly SystemParameters2 _threadLocalSingleton;
private MessageWindow _messageHwnd;
@@ -218,7 +218,7 @@ private void _InitializeThemeInfo()
return;
}
- NativeMethods.GetCurrentThemeName(out var name, out var color, out var size);
+ NativeMethods.GetCurrentThemeName(out var name, out var color, out _);
// Consider whether this is the most useful way to expose this...
UxThemeName = System.IO.Path.GetFileNameWithoutExtension(name);
@@ -237,18 +237,18 @@ private void _InitializeWindowCornerRadius()
// There aren't any known variations based on theme color.
Assert.IsNeitherNullNorEmpty(UxThemeName);
- // These radii are approximate. The way WPF does rounding is different than how
- // rounded-rectangle HRGNs are created, which is also different than the actual
- // round corners on themed Windows. For now we're not exposing anything to
- // mitigate the differences.
- var cornerRadius = default(CornerRadius);
-
- // This list is known to be incomplete and very much not future-proof.
- // On XP there are at least a couple of shipped themes that this won't catch,
- // "Zune" and "Royale", but WPF doesn't know about these either.
- // If a new theme was to replace Aero, then this will fall back on "classic" behaviors.
- // This isn't ideal, but it's not the end of the world. WPF will generally have problems anyways.
- switch (UxThemeName.ToUpperInvariant())
+ // These radii are approximate. The way WPF does rounding is different than how
+ // rounded-rectangle HRGNs are created, which is also different than the actual
+ // round corners on themed Windows. For now we're not exposing anything to
+ // mitigate the differences.
+ CornerRadius cornerRadius;
+
+ // This list is known to be incomplete and very much not future-proof.
+ // On XP there are at least a couple of shipped themes that this won't catch,
+ // "Zune" and "Royale", but WPF doesn't know about these either.
+ // If a new theme was to replace Aero, then this will fall back on "classic" behaviors.
+ // This isn't ideal, but it's not the end of the world. WPF will generally have problems anyways.
+ switch (UxThemeName.ToUpperInvariant())
{
case "LUNA":
cornerRadius = new CornerRadius(6, 6, 0, 0);
@@ -331,7 +331,7 @@ private SystemParameters2()
};
}
- public static SystemParameters2 Current => _threadLocalSingleton ?? (_threadLocalSingleton = new SystemParameters2());
+ public static SystemParameters2 Current => _threadLocalSingleton ?? new SystemParameters2();
private IntPtr _WndProc(IntPtr hwnd, WM msg, IntPtr wParam, IntPtr lParam)
{
diff --git a/source/Components/AvalonDock/Controls/Shell/WindowChromeWorker.cs b/source/Components/AvalonDock/Controls/Shell/WindowChromeWorker.cs
index a347f46e..d7b8fa8a 100644
--- a/source/Components/AvalonDock/Controls/Shell/WindowChromeWorker.cs
+++ b/source/Components/AvalonDock/Controls/Shell/WindowChromeWorker.cs
@@ -48,7 +48,7 @@ internal class WindowChromeWorker : DependencyObject
private bool _isFixedUp = false;
private bool _isUserResizing = false;
private bool _hasUserMovedWindow = false;
- private Point _windowPosAtStartOfUserMove = default(Point);
+ private Point _windowPosAtStartOfUserMove = default;
// Field to track attempts to force off Device Bitmaps on Win7.
private int _blackGlassFixupAttemptCount;
@@ -415,6 +415,13 @@ private IntPtr _HandleNCCalcSize(WM uMsg, IntPtr wParam, IntPtr lParam, out bool
// Since we always want the client size to equal the window size, we can unconditionally handle it
// without having to modify the parameters.
handled = true;
+ if (wParam != IntPtr.Zero)
+ {
+ var client = (RECT)Marshal.PtrToStructure(lParam, typeof(RECT));
+ client.Bottom++;
+ Marshal.StructureToPtr(client, lParam, false);
+ return IntPtr.Zero;
+ }
return new IntPtr((int)WVR.REDRAW);
}
@@ -424,7 +431,7 @@ private IntPtr _HandleNCHitTest(WM uMsg, IntPtr wParam, IntPtr lParam, out bool
handled = false;
// Give DWM a chance at this first.
- if (Utility.IsOSVistaOrNewer && _chromeInfo.GlassFrameThickness != default(Thickness) && _isGlassEnabled)
+ if (Utility.IsOSVistaOrNewer && _chromeInfo.GlassFrameThickness != default && _isGlassEnabled)
{
// If we're on Vista, give the DWM a chance to handle the message first.
handled = NativeMethods.DwmDefWindowProc(_hwnd, uMsg, wParam, lParam, out lRet);
@@ -686,7 +693,7 @@ private void _UpdateFrameState(bool force)
var frameState = NativeMethods.DwmIsCompositionEnabled();
if (!force && frameState == _isGlassEnabled) return;
- _isGlassEnabled = frameState && _chromeInfo.GlassFrameThickness != default(Thickness);
+ _isGlassEnabled = frameState && _chromeInfo.GlassFrameThickness != default;
if (_isGlassEnabled)
{
diff --git a/source/Components/AvalonDock/Converters/ActivateCommandLayoutItemFromLayoutModelConverter.cs b/source/Components/AvalonDock/Converters/ActivateCommandLayoutItemFromLayoutModelConverter.cs
index 1d852fd8..c5bab8ae 100644
--- a/source/Components/AvalonDock/Converters/ActivateCommandLayoutItemFromLayoutModelConverter.cs
+++ b/source/Components/AvalonDock/Converters/ActivateCommandLayoutItemFromLayoutModelConverter.cs
@@ -9,58 +9,63 @@ This program is provided to you under the terms of the Microsoft Public
using System;
using System.Windows.Data;
+using System.Windows.Markup;
using AvalonDock.Layout;
namespace AvalonDock.Converters
{
- ///
- /// Converts a into an
- /// and ensures that other essential properties (Root, Root.Manager) are available.
- ///
- /// Returns null or Binding.DoNothing otherwise.
- ///
- public class ActivateCommandLayoutItemFromLayoutModelConverter : IValueConverter
- {
- ///
- /// Converts a into an
- /// and ensures that other essential properties (Root, Root.Manager) are available.
- ///
- /// The value produced by the binding source.
- /// The type of the binding target property.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- /// A converted value. If the method returns null, the valid null value is used.
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- //when this converter is called layout could be constructing so many properties here are potentially not valid
- var layoutModel = value as LayoutContent;
- if (layoutModel == null)
- return null;
+ ///
+ /// Converts a into an
+ /// and ensures that other essential properties (Root, Root.Manager) are available.
+ ///
+ /// Returns null or Binding.DoNothing otherwise.
+ ///
+ public class ActivateCommandLayoutItemFromLayoutModelConverter : MarkupExtension, IValueConverter
+ {
+ ///
+ /// Converts a into an
+ /// and ensures that other essential properties (Root, Root.Manager) are available.
+ ///
+ /// The value produced by the binding source.
+ /// The type of the binding target property.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ /// A converted value. If the method returns null, the valid null value is used.
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ //when this converter is called layout could be constructing so many properties here are potentially not valid
+ if (!(value is LayoutContent layoutModel))
+ return null;
- if (layoutModel.Root == null)
- return null;
+ if (layoutModel.Root == null)
+ return null;
- if (layoutModel.Root.Manager == null)
- return null;
+ if (layoutModel.Root.Manager == null)
+ return null;
- var layoutItemModel = layoutModel.Root.Manager.GetLayoutItemFromModel(layoutModel);
- if (layoutItemModel == null)
- return Binding.DoNothing;
+ var layoutItemModel = layoutModel.Root.Manager.GetLayoutItemFromModel(layoutModel);
+ if (layoutItemModel == null)
+ return Binding.DoNothing;
- return layoutItemModel.ActivateCommand;
- }
+ return layoutItemModel.ActivateCommand;
+ }
- ///
- /// Method is not implemented and will raise when called.
- ///
- ///
- ///
- ///
- ///
- ///
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
+ ///
+ /// Method is not implemented and will raise when called.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ConverterCreater.Get();
+ }
+ }
}
diff --git a/source/Components/AvalonDock/Converters/AnchorSideToAngleConverter.cs b/source/Components/AvalonDock/Converters/AnchorSideToAngleConverter.cs
index af1ae7a5..909aa52a 100644
--- a/source/Components/AvalonDock/Converters/AnchorSideToAngleConverter.cs
+++ b/source/Components/AvalonDock/Converters/AnchorSideToAngleConverter.cs
@@ -9,50 +9,56 @@ This program is provided to you under the terms of the Microsoft Public
using System;
using System.Windows.Data;
+using System.Windows.Markup;
using AvalonDock.Layout;
namespace AvalonDock.Converters
{
- ///
- /// Converts an value into a floating point value that
- /// indicates whether the content should be rotated by 90.0 degrees or not.
- ///
- /// Returns Binding.DoNothing if not rotation is required.
- ///
- [ValueConversion(typeof(AnchorSide), typeof(double))]
- public class AnchorSideToAngleConverter : IValueConverter
- {
- ///
- /// Converts an value into a floating point value that
- /// indicates whether the content should be rotated by 90.0 degrees or not.
- ///
- /// Returns Binding.DoNothing if not rotation is required.
- ///
- /// The value produced by the binding source.
- /// The type of the binding target property.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- /// A converted value.
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- AnchorSide side = (AnchorSide)value;
- if (side == AnchorSide.Left || side == AnchorSide.Right)
- return 90.0;
+ ///
+ /// Converts an value into a floating point value that
+ /// indicates whether the content should be rotated by 90.0 degrees or not.
+ ///
+ /// Returns Binding.DoNothing if not rotation is required.
+ ///
+ [ValueConversion(typeof(AnchorSide), typeof(double))]
+ public class AnchorSideToAngleConverter : MarkupExtension, IValueConverter
+ {
+ ///
+ /// Converts an value into a floating point value that
+ /// indicates whether the content should be rotated by 90.0 degrees or not.
+ ///
+ /// Returns Binding.DoNothing if not rotation is required.
+ ///
+ /// The value produced by the binding source.
+ /// The type of the binding target property.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ /// A converted value.
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ AnchorSide side = (AnchorSide)value;
+ if (side == AnchorSide.Left || side == AnchorSide.Right)
+ return 90.0;
- return Binding.DoNothing;
- }
+ return Binding.DoNothing;
+ }
- ///
- /// Method is not implemented and will raise when called.
- ///
- ///
- ///
- ///
- ///
- ///
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
+ ///
+ /// Method is not implemented and will raise when called.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ConverterCreater.Get();
+ }
+ }
}
diff --git a/source/Components/AvalonDock/Converters/AnchorSideToOrientationConverter.cs b/source/Components/AvalonDock/Converters/AnchorSideToOrientationConverter.cs
index 0928f43a..4e217012 100644
--- a/source/Components/AvalonDock/Converters/AnchorSideToOrientationConverter.cs
+++ b/source/Components/AvalonDock/Converters/AnchorSideToOrientationConverter.cs
@@ -11,6 +11,7 @@ This program is provided to you under the terms of the Microsoft Public
using System.Windows.Data;
using System.Windows.Controls;
using AvalonDock.Layout;
+using System.Windows.Markup;
namespace AvalonDock.Converters
{
@@ -21,7 +22,7 @@ namespace AvalonDock.Converters
/// othrwise is returned.
///
[ValueConversion(typeof(AnchorSide), typeof(Orientation))]
- public class AnchorSideToOrientationConverter : IValueConverter
+ public class AnchorSideToOrientationConverter : MarkupExtension, IValueConverter
{
///
/// Converts an value into a WPF value.
@@ -55,5 +56,10 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
{
throw new NotImplementedException();
}
- }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ConverterCreater.Get();
+ }
+ }
}
diff --git a/source/Components/AvalonDock/Converters/AnchorableContextMenuHideVisibilityConverter.cs b/source/Components/AvalonDock/Converters/AnchorableContextMenuHideVisibilityConverter.cs
index aa4e73a8..2a97a6ee 100644
--- a/source/Components/AvalonDock/Converters/AnchorableContextMenuHideVisibilityConverter.cs
+++ b/source/Components/AvalonDock/Converters/AnchorableContextMenuHideVisibilityConverter.cs
@@ -12,62 +12,68 @@ This program is provided to you under the terms of the Microsoft Public
using System.Linq;
using System.Windows;
using System.Windows.Data;
+using System.Windows.Markup;
namespace AvalonDock.Converters
{
- ///
- /// Converts a binding of 2 values:
- /// 1) and
- /// 2) bool
- /// into a value.
- ///
- /// The actual value returned is 1) if 2) is true,
- /// is returned otherwise.
- ///
- public class AnchorableContextMenuHideVisibilityConverter : IMultiValueConverter
- {
- ///
- /// Converts a binding of 2 values:
- /// 1) and
- /// 2) bool
- /// into a value.
- ///
- /// The actual value returned is 1) if 2) is true,
- /// is returned otherwise.
- ///
- /// The value produced by the binding source.
- /// The type of the binding target property.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- /// A converted value. If the method returns null, the valid null value is used.
- public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
- {
- if ((values.Count() == 2)
- && (values[0] != DependencyProperty.UnsetValue)
- && (values[1] != DependencyProperty.UnsetValue)
- && (values[1] is bool))
- {
- var canClose = (bool)values[1];
+ ///
+ /// Converts a binding of 2 values:
+ /// 1) and
+ /// 2) bool
+ /// into a value.
+ ///
+ /// The actual value returned is 1) if 2) is true,
+ /// is returned otherwise.
+ ///
+ public class AnchorableContextMenuHideVisibilityConverter : MarkupExtension, IMultiValueConverter
+ {
+ ///
+ /// Converts a binding of 2 values:
+ /// 1) and
+ /// 2) bool
+ /// into a value.
+ ///
+ /// The actual value returned is 1) if 2) is true,
+ /// is returned otherwise.
+ ///
+ /// The value produced by the binding source.
+ /// The type of the binding target property.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ /// A converted value. If the method returns null, the valid null value is used.
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ if ((values.Count() == 2)
+ && (values[0] != DependencyProperty.UnsetValue)
+ && (values[1] != DependencyProperty.UnsetValue)
+ && (values[1] is bool boolean))
+ {
+ var canClose = boolean;
- return canClose ? Visibility.Collapsed : values[0];
- }
- else
- {
- return values[0];
- }
- }
+ return canClose ? Visibility.Collapsed : values[0];
+ }
+ else
+ {
+ return values[0];
+ }
+ }
- ///
- /// Method is not implemented and will raise when called.
- ///
- ///
- ///
- ///
- ///
- ///
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
+ ///
+ /// Method is not implemented and will raise when called.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ConverterCreater.Get();
+ }
+ }
}
diff --git a/source/Components/AvalonDock/Converters/AutoHideCommandLayoutItemFromLayoutModelConverter.cs b/source/Components/AvalonDock/Converters/AutoHideCommandLayoutItemFromLayoutModelConverter.cs
index aa3ddcea..27cd3b0e 100644
--- a/source/Components/AvalonDock/Converters/AutoHideCommandLayoutItemFromLayoutModelConverter.cs
+++ b/source/Components/AvalonDock/Converters/AutoHideCommandLayoutItemFromLayoutModelConverter.cs
@@ -11,59 +11,63 @@ This program is provided to you under the terms of the Microsoft Public
using System.Windows.Data;
using AvalonDock.Layout;
using AvalonDock.Controls;
+using System.Windows.Markup;
namespace AvalonDock.Converters
{
- ///
- /// Converts a into a
- /// and ensures that other essential properties (Root, Root.Manager) are available.
- ///
- /// Returns null or Binding.DoNothing otherwise.
- ///
- public class AutoHideCommandLayoutItemFromLayoutModelConverter : IValueConverter
- {
- ///
- /// Converts a into a
- /// and ensures that other essential properties (Root, Root.Manager) are available.
- ///
- /// Returns null or Binding.DoNothing otherwise.
- ///
- /// The value produced by the binding source.
- /// The type of the binding target property.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- /// A converted value.
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- //when this converter is called layout could be constructing so many properties here are potentially not valid
- var layoutModel = value as LayoutContent;
- if (layoutModel == null)
- return null;
+ ///
+ /// Converts a into a
+ /// and ensures that other essential properties (Root, Root.Manager) are available.
+ ///
+ /// Returns null or Binding.DoNothing otherwise.
+ ///
+ public class AutoHideCommandLayoutItemFromLayoutModelConverter : MarkupExtension, IValueConverter
+ {
+ ///
+ /// Converts a into a
+ /// and ensures that other essential properties (Root, Root.Manager) are available.
+ ///
+ /// Returns null or Binding.DoNothing otherwise.
+ ///
+ /// The value produced by the binding source.
+ /// The type of the binding target property.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ /// A converted value.
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ //when this converter is called layout could be constructing so many properties here are potentially not valid
+ if (value as LayoutContent == null)
+ return null;
- if (layoutModel.Root == null)
- return null;
+ if ((value as LayoutContent).Root == null)
+ return null;
- if (layoutModel.Root.Manager == null)
- return null;
+ if ((value as LayoutContent).Root.Manager == null)
+ return null;
- var layoutItemModel = layoutModel.Root.Manager.GetLayoutItemFromModel(layoutModel) as LayoutAnchorableItem;
- if (layoutItemModel == null)
- return Binding.DoNothing;
+ if (!((value as LayoutContent).Root.Manager.GetLayoutItemFromModel(value as LayoutContent) is LayoutAnchorableItem layoutItemModel))
+ return Binding.DoNothing;
- return layoutItemModel.AutoHideCommand;
- }
+ return layoutItemModel.AutoHideCommand;
+ }
- ///
- /// Method is not implemented and will raise when called.
- ///
- ///
- ///
- ///
- ///
- ///
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
+ ///
+ /// Method is not implemented and will raise when called.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ConverterCreater.Get();
+ }
+ }
}
diff --git a/source/Components/AvalonDock/Converters/BoolToVisibilityConverter.cs b/source/Components/AvalonDock/Converters/BoolToVisibilityConverter.cs
index 63e06c62..1f8ba742 100644
--- a/source/Components/AvalonDock/Converters/BoolToVisibilityConverter.cs
+++ b/source/Components/AvalonDock/Converters/BoolToVisibilityConverter.cs
@@ -10,60 +10,66 @@ This program is provided to you under the terms of the Microsoft Public
using System;
using System.Windows.Data;
using System.Windows;
+using System.Windows.Markup;
namespace AvalonDock.Converters
{
- ///
- ///
- /// Converts a bool value into a value and back.
- ///
- [ValueConversion(typeof(bool), typeof(Visibility))]
- public class BoolToVisibilityConverter : IValueConverter
- {
- ///
- ///
- /// Converts a bool value into a value.
- ///
- /// The value produced by the binding source.
- /// The type of the binding target property.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- ///
- /// A converted value. If the method returns null, the valid null value is used.
- ///
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- switch (value)
- {
- case bool val when targetType == typeof(Visibility):
- if (val) return Visibility.Visible;
- return parameter is Visibility ? parameter : Visibility.Collapsed;
- case null when parameter is Visibility:
- return parameter;
- case null:
- return Visibility.Collapsed;
- default:
- return Visibility.Visible;
- ///throw new ArgumentException("Invalid argument/return type. Expected argument: bool and return type: Visibility");
- }
- }
+ ///
+ ///
+ /// Converts a bool value into a value and back.
+ ///
+ [ValueConversion(typeof(bool), typeof(Visibility))]
+ public class BoolToVisibilityConverter : MarkupExtension, IValueConverter
+ {
+ ///
+ ///
+ /// Converts a bool value into a value.
+ ///
+ /// The value produced by the binding source.
+ /// The type of the binding target property.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ ///
+ /// A converted value. If the method returns null, the valid null value is used.
+ ///
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ switch (value)
+ {
+ case bool val when targetType == typeof(Visibility):
+ if (val) return Visibility.Visible;
+ return parameter is Visibility ? parameter : Visibility.Collapsed;
+ case null when parameter is Visibility:
+ return parameter;
+ case null:
+ return Visibility.Collapsed;
+ default:
+ return Visibility.Visible;
+ ///throw new ArgumentException("Invalid argument/return type. Expected argument: bool and return type: Visibility");
+ }
+ }
- ///
- ///
- /// Converts a value into a bool value.
- ///
- /// The value that is produced by the binding target.
- /// The type to convert to.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- ///
- /// A converted value. If the method returns null, the valid null value is used.
- ///
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (!(value is Visibility)) throw new ArgumentException("Invalid argument type. Expected argument: Visibility.", nameof(value));
- if (targetType != typeof(bool)) throw new ArgumentException("Invalid return type. Expected type: bool", nameof(targetType));
- return (Visibility)value == Visibility.Visible;
- }
- }
+ ///
+ ///
+ /// Converts a value into a bool value.
+ ///
+ /// The value that is produced by the binding target.
+ /// The type to convert to.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ ///
+ /// A converted value. If the method returns null, the valid null value is used.
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ if (!(value is Visibility)) throw new ArgumentException("Invalid argument type. Expected argument: Visibility.", nameof(value));
+ if (targetType != typeof(bool)) throw new ArgumentException("Invalid return type. Expected type: bool", nameof(targetType));
+ return (Visibility)value == Visibility.Visible;
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ConverterCreater.Get();
+ }
+ }
}
diff --git a/source/Components/AvalonDock/Converters/ConverterCreater.cs b/source/Components/AvalonDock/Converters/ConverterCreater.cs
new file mode 100644
index 00000000..63d81b6e
--- /dev/null
+++ b/source/Components/AvalonDock/Converters/ConverterCreater.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvalonDock.Converters
+{
+ internal class ConverterCreater
+ {
+ #region Private fields
+
+ private static readonly Dictionary ConverterMap = new Dictionary();
+
+ #endregion Private fields
+
+ #region Public methods
+
+ public static T Get() where T : new()
+ {
+ if (!ConverterMap.ContainsKey(typeof(T)))
+ {
+ ConverterMap.Add(typeof(T), new T());
+ }
+ return (T)ConverterMap[typeof(T)];
+ }
+
+ #endregion Public methods
+ }
+}
\ No newline at end of file
diff --git a/source/Components/AvalonDock/Converters/HideCommandLayoutItemFromLayoutModelConverter.cs b/source/Components/AvalonDock/Converters/HideCommandLayoutItemFromLayoutModelConverter.cs
index 020e72d4..0958ba38 100644
--- a/source/Components/AvalonDock/Converters/HideCommandLayoutItemFromLayoutModelConverter.cs
+++ b/source/Components/AvalonDock/Converters/HideCommandLayoutItemFromLayoutModelConverter.cs
@@ -11,59 +11,63 @@ This program is provided to you under the terms of the Microsoft Public
using System.Windows.Data;
using AvalonDock.Layout;
using AvalonDock.Controls;
+using System.Windows.Markup;
namespace AvalonDock.Converters
{
- ///
- /// Converts a into a
- /// and ensures that other essential properties (Root, Root.Manager) are available.
- ///
- /// Returns null or Binding.DoNothing otherwise.
- ///
- public class HideCommandLayoutItemFromLayoutModelConverter : IValueConverter
- {
- ///
- /// Converts a into a
- /// and ensures that other essential properties (Root, Root.Manager) are available.
- ///
- /// Returns null or Binding.DoNothing otherwise.
- ///
- /// The value produced by the binding source.
- /// The type of the binding target property.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- /// A converted value.
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- //when this converter is called layout could be constructing so many properties here are potentially not valid
- var layoutModel = value as LayoutContent;
- if (layoutModel == null)
- return null;
+ ///
+ /// Converts a into a
+ /// and ensures that other essential properties (Root, Root.Manager) are available.
+ ///
+ /// Returns null or Binding.DoNothing otherwise.
+ ///
+ public class HideCommandLayoutItemFromLayoutModelConverter : MarkupExtension, IValueConverter
+ {
+ ///
+ /// Converts a into a
+ /// and ensures that other essential properties (Root, Root.Manager) are available.
+ ///
+ /// Returns null or Binding.DoNothing otherwise.
+ ///
+ /// The value produced by the binding source.
+ /// The type of the binding target property.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ /// A converted value.
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ //when this converter is called layout could be constructing so many properties here are potentially not valid
+ if (!(value is LayoutContent layoutModel))
+ return null;
- if (layoutModel.Root == null)
- return null;
+ if (layoutModel.Root == null)
+ return null;
- if (layoutModel.Root.Manager == null)
- return null;
+ if (layoutModel.Root.Manager == null)
+ return null;
- var layoutItemModel = layoutModel.Root.Manager.GetLayoutItemFromModel(layoutModel) as LayoutAnchorableItem;
- if (layoutItemModel == null)
- return Binding.DoNothing;
+ if (!(layoutModel.Root.Manager.GetLayoutItemFromModel(layoutModel) is LayoutAnchorableItem layoutItemModel))
+ return Binding.DoNothing;
- return layoutItemModel.HideCommand;
- }
+ return layoutItemModel.HideCommand;
+ }
- ///
- /// Method is not implemented and will raise when called.
- ///
- ///
- ///
- ///
- ///
- ///
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
+ ///
+ /// Method is not implemented and will raise when called.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ConverterCreater.Get();
+ }
+ }
}
diff --git a/source/Components/AvalonDock/Converters/InverseBoolToVisibilityConverter.cs b/source/Components/AvalonDock/Converters/InverseBoolToVisibilityConverter.cs
index 177b1ac5..e13d6c5e 100644
--- a/source/Components/AvalonDock/Converters/InverseBoolToVisibilityConverter.cs
+++ b/source/Components/AvalonDock/Converters/InverseBoolToVisibilityConverter.cs
@@ -10,45 +10,51 @@ This program is provided to you under the terms of the Microsoft Public
using System;
using System.Windows.Data;
using System.Windows;
+using System.Windows.Markup;
namespace AvalonDock.Converters
{
- ///
- ///
- /// Converts an inverted bool value into a value.
- ///
- [ValueConversion(typeof(bool), typeof(Visibility))]
- public class InverseBoolToVisibilityConverter : IValueConverter
- {
- ///
- /// Converts an inverted bool value into a value.
- /// The value produced by the binding source.
- /// The type of the binding target property.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- /// A converted value. If the method returns null, the valid null value is used.
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (!(value is bool)) throw new ArgumentException("Invalid argument type. Expected argument: bool.", nameof(value));
- if (targetType != typeof(Visibility)) throw new ArgumentException("Invalid return type. Expected type: Visibility", nameof(targetType));
- var val = !(bool)value;
- if (val) return Visibility.Visible;
- return parameter is Visibility ? parameter : Visibility.Collapsed;
- }
+ ///
+ ///
+ /// Converts an inverted bool value into a value.
+ ///
+ [ValueConversion(typeof(bool), typeof(Visibility))]
+ public class InverseBoolToVisibilityConverter : MarkupExtension, IValueConverter
+ {
+ ///
+ /// Converts an inverted bool value into a value.
+ /// The value produced by the binding source.
+ /// The type of the binding target property.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ /// A converted value. If the method returns null, the valid null value is used.
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ if (!(value is bool)) throw new ArgumentException("Invalid argument type. Expected argument: bool.", nameof(value));
+ if (targetType != typeof(Visibility)) throw new ArgumentException("Invalid return type. Expected type: Visibility", nameof(targetType));
+ var val = !(bool)value;
+ if (val) return Visibility.Visible;
+ return parameter is Visibility ? parameter : Visibility.Collapsed;
+ }
- ///
- /// Converts an inverted value into a bool value.
- /// The value that is produced by the binding target.
- /// The type to convert to.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- /// A converted value. If the method returns null, the valid null value is used.
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (!(value is Visibility)) throw new ArgumentException("Invalid argument type. Expected argument: Visibility.", nameof(value));
- if (targetType != typeof(bool)) throw new ArgumentException("Invalid return type. Expected type: bool", nameof(targetType));
- Visibility val = (Visibility)value;
- return val != Visibility.Visible;
- }
- }
+ ///
+ /// Converts an inverted value into a bool value.
+ /// The value that is produced by the binding target.
+ /// The type to convert to.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ /// A converted value. If the method returns null, the valid null value is used.
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ if (!(value is Visibility)) throw new ArgumentException("Invalid argument type. Expected argument: Visibility.", nameof(value));
+ if (targetType != typeof(bool)) throw new ArgumentException("Invalid return type. Expected type: bool", nameof(targetType));
+ Visibility val = (Visibility)value;
+ return val != Visibility.Visible;
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ConverterCreater.Get();
+ }
+ }
}
diff --git a/source/Components/AvalonDock/Converters/LayoutItemFromLayoutModelConverter.cs b/source/Components/AvalonDock/Converters/LayoutItemFromLayoutModelConverter.cs
index 4fa3d134..be9b3549 100644
--- a/source/Components/AvalonDock/Converters/LayoutItemFromLayoutModelConverter.cs
+++ b/source/Components/AvalonDock/Converters/LayoutItemFromLayoutModelConverter.cs
@@ -9,59 +9,63 @@ This program is provided to you under the terms of the Microsoft Public
using System;
using System.Windows.Data;
+using System.Windows.Markup;
using AvalonDock.Layout;
namespace AvalonDock.Converters
{
- ///
- /// Converts a into a
- /// and ensures that other essential properties (Root, Root.Manager) are available.
- ///
- /// Returns null or Binding.DoNothing otherwise.
- ///
- public class LayoutItemFromLayoutModelConverter : IValueConverter
- {
- ///
- /// Converts a into a
- /// and ensures that other essential properties (Root, Root.Manager) are available.
- ///
- /// Returns null or Binding.DoNothing otherwise.
- ///
- /// The value produced by the binding source.
- /// The type of the binding target property.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- /// A converted value.
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- var layoutModel = value as LayoutContent;
- if (layoutModel == null)
- return null;
+ ///
+ /// Converts a into a
+ /// and ensures that other essential properties (Root, Root.Manager) are available.
+ ///
+ /// Returns null or Binding.DoNothing otherwise.
+ ///
+ public class LayoutItemFromLayoutModelConverter : MarkupExtension, IValueConverter
+ {
+ ///
+ /// Converts a into a
+ /// and ensures that other essential properties (Root, Root.Manager) are available.
+ ///
+ /// Returns null or Binding.DoNothing otherwise.
+ ///
+ /// The value produced by the binding source.
+ /// The type of the binding target property.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ /// A converted value.
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ if (!(value is LayoutContent layoutModel))
+ return null;
- if (layoutModel.Root == null)
- return null;
+ if (layoutModel.Root == null)
+ return null;
- if (layoutModel.Root.Manager == null)
- return null;
+ if (layoutModel.Root.Manager == null)
+ return null;
- var layoutItemModel = layoutModel.Root.Manager.GetLayoutItemFromModel(layoutModel);
- if (layoutItemModel == null)
- return Binding.DoNothing;
+ if (layoutModel.Root.Manager.GetLayoutItemFromModel(layoutModel) == null)
+ return Binding.DoNothing;
- return layoutItemModel;
- }
+ return layoutModel.Root.Manager.GetLayoutItemFromModel(layoutModel);
+ }
- ///
- /// Method is not implemented and will raise when called.
- ///
- ///
- ///
- ///
- ///
- ///
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
+ ///
+ /// Method is not implemented and will raise when called.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ConverterCreater.Get();
+ }
+ }
}
diff --git a/source/Components/AvalonDock/Converters/NullToDoNothingConverter.cs b/source/Components/AvalonDock/Converters/NullToDoNothingConverter.cs
index 86a7bd05..c8a6ee81 100644
--- a/source/Components/AvalonDock/Converters/NullToDoNothingConverter.cs
+++ b/source/Components/AvalonDock/Converters/NullToDoNothingConverter.cs
@@ -9,41 +9,47 @@ This program is provided to you under the terms of the Microsoft Public
using System;
using System.Windows.Data;
+using System.Windows.Markup;
namespace AvalonDock.Converters
{
- ///
- /// Converts any null value into Binding.DoNothing and returns the bound value, otherwise.
- ///
- public class NullToDoNothingConverter : IValueConverter
- {
- ///
- /// Converts any null value into Binding.DoNothing and returns the bound value, otherwise.
- ///
- /// The value produced by the binding source.
- /// The type of the binding target property.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- /// A converted value.
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (value == null)
- return Binding.DoNothing;
+ ///
+ /// Converts any null value into Binding.DoNothing and returns the bound value, otherwise.
+ ///
+ public class NullToDoNothingConverter : MarkupExtension, IValueConverter
+ {
+ ///
+ /// Converts any null value into Binding.DoNothing and returns the bound value, otherwise.
+ ///
+ /// The value produced by the binding source.
+ /// The type of the binding target property.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ /// A converted value.
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ if (value == null)
+ return Binding.DoNothing;
- return value;
- }
+ return value;
+ }
- ///
- /// Method is not implemented and will raise when called.
- ///
- ///
- ///
- ///
- ///
- ///
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
+ ///
+ /// Method is not implemented and will raise when called.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ConverterCreater.Get();
+ }
+ }
}
diff --git a/source/Components/AvalonDock/Converters/OverlayWindowToVisibilityConverter.cs b/source/Components/AvalonDock/Converters/OverlayWindowToVisibilityConverter.cs
index 2804c1a0..1dc6a76c 100644
--- a/source/Components/AvalonDock/Converters/OverlayWindowToVisibilityConverter.cs
+++ b/source/Components/AvalonDock/Converters/OverlayWindowToVisibilityConverter.cs
@@ -10,46 +10,52 @@ This program is provided to you under the terms of the Microsoft Public
using System;
using System.Windows;
using System.Windows.Data;
+using System.Windows.Markup;
using AvalonDock.Controls;
using AvalonDock.Layout;
namespace AvalonDock.Converters
{
- ///
- /// Converts a into a
- /// and ensures that other essential properties (Root, Root.Manager) are available.
- ///
- /// Returns null or Binding.DoNothing otherwise.
- ///
- public class OverlayWindowToVisibilityConverter : IValueConverter
- {
- ///
- /// Converts a into a .
- ///
- /// The value produced by the binding source.
- /// The type of the binding target property.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- /// A converted value.
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- bool isHostedInFloatingWindow = value is OverlayWindow overlayWindow && overlayWindow.IsHostedInFloatingWindow;
- if (parameter == null || !bool.TryParse(parameter.ToString(), out bool isLarge))
- {
- isLarge = false;
- }
+ ///
+ /// Converts a into a
+ /// and ensures that other essential properties (Root, Root.Manager) are available.
+ ///
+ /// Returns null or Binding.DoNothing otherwise.
+ ///
+ public class OverlayWindowToVisibilityConverter : MarkupExtension, IValueConverter
+ {
+ ///
+ /// Converts a into a .
+ ///
+ /// The value produced by the binding source.
+ /// The type of the binding target property.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ /// A converted value.
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ bool isHostedInFloatingWindow = value is OverlayWindow overlayWindow && overlayWindow.IsHostedInFloatingWindow;
+ if (parameter == null || !bool.TryParse(parameter.ToString(), out bool isLarge))
+ {
+ isLarge = false;
+ }
- return isHostedInFloatingWindow && isLarge ? Visibility.Hidden : Visibility.Visible;
- }
+ return isHostedInFloatingWindow && isLarge ? Visibility.Hidden : Visibility.Visible;
+ }
- ///
- /// Method is not implemented and will raise when called.
- ///
- /// The value that is produced by the binding target.
- /// The type to convert to.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- ///
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) => throw new NotSupportedException();
- }
+ ///
+ /// Method is not implemented and will raise when called.
+ ///
+ /// The value that is produced by the binding target.
+ /// The type to convert to.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) => throw new NotSupportedException();
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ConverterCreater.Get();
+ }
+ }
}
diff --git a/source/Components/AvalonDock/Converters/UriSourceToBitmapImageConverter.cs b/source/Components/AvalonDock/Converters/UriSourceToBitmapImageConverter.cs
index f0ddb0e2..86ef8ca2 100644
--- a/source/Components/AvalonDock/Converters/UriSourceToBitmapImageConverter.cs
+++ b/source/Components/AvalonDock/Converters/UriSourceToBitmapImageConverter.cs
@@ -11,47 +11,53 @@ This program is provided to you under the terms of the Microsoft Public
using System.Windows.Data;
using System.Windows.Media.Imaging;
using System.Windows.Controls;
+using System.Windows.Markup;
namespace AvalonDock.Converters
{
- ///
- /// Converts a object into a corresponding object
- /// that is expected to be available at the given target of the uri.
- ///
- /// Returns null or Binding.DoNothing otherwise.
- ///
- public class UriSourceToBitmapImageConverter : IValueConverter
- {
- ///
- /// Converts a object into a corresponding object
- /// that is expected to be available at the given target of the uri.
- ///
- /// Returns null or Binding.DoNothing otherwise.
- ///
- /// The value produced by the binding source.
- /// The type of the binding target property.
- /// The converter parameter to use.
- /// The culture to use in the converter.
- /// A converted value.
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (value == null)
- return Binding.DoNothing;
+ ///
+ /// Converts a object into a corresponding object
+ /// that is expected to be available at the given target of the uri.
+ ///
+ /// Returns null or Binding.DoNothing otherwise.
+ ///
+ public class UriSourceToBitmapImageConverter : MarkupExtension, IValueConverter
+ {
+ ///
+ /// Converts a object into a corresponding object
+ /// that is expected to be available at the given target of the uri.
+ ///
+ /// Returns null or Binding.DoNothing otherwise.
+ ///
+ /// The value produced by the binding source.
+ /// The type of the binding target property.
+ /// The converter parameter to use.
+ /// The culture to use in the converter.
+ /// A converted value.
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ if (value == null)
+ return Binding.DoNothing;
- return new Image() { Source = new BitmapImage((Uri)value) };
- }
+ return new Image() { Source = new BitmapImage((Uri)value) };
+ }
- ///
- /// Method is not implemented and will raise when called.
- ///
- ///
- ///
- ///
- ///
- ///
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
+ ///
+ /// Method is not implemented and will raise when called.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ConverterCreater.Get();
+ }
+ }
}
diff --git a/source/Components/AvalonDock/DockingManager.cs b/source/Components/AvalonDock/DockingManager.cs
index b50dc10d..599b655b 100644
--- a/source/Components/AvalonDock/DockingManager.cs
+++ b/source/Components/AvalonDock/DockingManager.cs
@@ -24,857 +24,858 @@ This program is provided to you under the terms of the Microsoft Public
using System.Windows.Threading;
using AvalonDock.Themes;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
namespace AvalonDock
{
- ///
- ///
- ///
- /// The is the custom control at the root of the visual tree.
- /// This control is the core control of AvalonDock.
- /// It contains core dependency properties, events, and methods to customize and
- /// manage many aspects of the docking framework.
- ///
- ///
- ///
- [ContentProperty(nameof(Layout))]
- [TemplatePart(Name = "PART_AutoHideArea")]
- public class DockingManager : Control, IOverlayWindowHost//, ILogicalChildrenContainer
- {
- #region fields
- private ResourceDictionary currentThemeResourceDictionary; // = null
- private AutoHideWindowManager _autoHideWindowManager;
- private FrameworkElement _autohideArea;
- private List _fwList = new List();
- private List _fwHiddenList = new List();
- private OverlayWindow _overlayWindow = null;
- private List _areas = null;
- private bool _insideInternalSetActiveContent = false;
-
- // Collection of LayoutDocumentItems & LayoutAnchorableItems attached to their corresponding
- // LayoutDocument & LayoutAnchorable
- private List _layoutItems = new List();
-
- private bool _suspendLayoutItemCreation = false;
- private DispatcherOperation _collectLayoutItemsOperations = null;
- private NavigatorWindow _navigatorWindow = null;
-
- internal bool SuspendDocumentsSourceBinding = false;
- internal bool SuspendAnchorablesSourceBinding = false;
- #endregion fields
-
- #region Constructors
- ///
- /// Static class constructor to support WPF property control registration.
- ///
- static DockingManager()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(DockingManager), new FrameworkPropertyMetadata(typeof(DockingManager)));
- FocusableProperty.OverrideMetadata(typeof(DockingManager), new FrameworkPropertyMetadata(false));
- HwndSource.DefaultAcquireHwndFocusInMenuMode = false;
- }
-
- ///
- /// Class constructor.
- ///
- public DockingManager()
- {
- IsVirtualizingDocument = true;
- IsVirtualizingAnchorable = true;
+ ///
+ ///
+ ///
+ /// The is the custom control at the root of the visual tree.
+ /// This control is the core control of AvalonDock.
+ /// It contains core dependency properties, events, and methods to customize and
+ /// manage many aspects of the docking framework.
+ ///
+ ///
+ ///
+ [ContentProperty(nameof(Layout))]
+ [TemplatePart(Name = "PART_AutoHideArea")]
+ public class DockingManager : Control, IOverlayWindowHost//, ILogicalChildrenContainer
+ {
+ #region fields
+ private ResourceDictionary currentThemeResourceDictionary; // = null
+ private AutoHideWindowManager _autoHideWindowManager;
+ private FrameworkElement _autohideArea;
+ private readonly List _fwList = new List();
+ private readonly List _fwHiddenList = new List();
+ private OverlayWindow _overlayWindow = null;
+ private List _areas = null;
+ private bool _insideInternalSetActiveContent = false;
+
+ // Collection of LayoutDocumentItems & LayoutAnchorableItems attached to their corresponding
+ // LayoutDocument & LayoutAnchorable
+ private readonly List _layoutItems = new List();
+
+ private bool _suspendLayoutItemCreation = false;
+ private DispatcherOperation _collectLayoutItemsOperations = null;
+ private NavigatorWindow _navigatorWindow = null;
+
+ internal bool SuspendDocumentsSourceBinding = false;
+ internal bool SuspendAnchorablesSourceBinding = false;
+ #endregion fields
+
+ #region Constructors
+ ///
+ /// Static class constructor to support WPF property control registration.
+ ///
+ static DockingManager()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(DockingManager), new FrameworkPropertyMetadata(typeof(DockingManager)));
+ FocusableProperty.OverrideMetadata(typeof(DockingManager), new FrameworkPropertyMetadata(false));
+ HwndSource.DefaultAcquireHwndFocusInMenuMode = false;
+ }
+
+ ///
+ /// Class constructor.
+ ///
+ public DockingManager()
+ {
+ IsVirtualizingDocument = true;
+ IsVirtualizingAnchorable = true;
#if !VS2008
- Layout = new LayoutRoot { RootPanel = new LayoutPanel(new LayoutDocumentPaneGroup(new LayoutDocumentPane())) };
+ Layout = new LayoutRoot { RootPanel = new LayoutPanel(new LayoutDocumentPaneGroup(new LayoutDocumentPane())) };
#else
this.SetCurrentValue( DockingManager.LayoutProperty, new LayoutRoot() { RootPanel = new LayoutPanel(new LayoutDocumentPaneGroup(new LayoutDocumentPane())) } );
#endif
- Loaded += DockingManager_Loaded;
- Unloaded += DockingManager_Unloaded;
- }
-
- #endregion Constructors
-
- #region Events
-
- /// Event fired when property changes.
- ///
- public event EventHandler LayoutChanged;
-
- /// Event fired when property is about to be changed.
- ///
- public event EventHandler LayoutChanging;
-
- /// Event fired when a document is about to be closed.
- /// Subscribers have the opportunity to cancel the operation.
- public event EventHandler DocumentClosing;
-
- /// Event fired after a document is closed.
- public event EventHandler DocumentClosed;
-
- /// Event is raised when changes.
- ///
- public event EventHandler ActiveContentChanged;
-
- #endregion Events
-
- #region Public Properties
-
- #region Layout
-
- /// dependency property.
- public static readonly DependencyProperty LayoutProperty = DependencyProperty.Register(nameof(Layout), typeof(LayoutRoot), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnLayoutChanged, CoerceLayoutValue));
-
- /// Gets or sets the property. This dependency property indicates layout tree.
- public LayoutRoot Layout
- {
- get => (LayoutRoot)GetValue(LayoutProperty);
- set => SetValue(LayoutProperty, value);
- }
-
- /// Coerces the value.
- private static object CoerceLayoutValue(DependencyObject d, object value)
- {
- if (value == null) return new LayoutRoot { RootPanel = new LayoutPanel(new LayoutDocumentPaneGroup(new LayoutDocumentPane())) };
- ((DockingManager)d).OnLayoutChanging(value as LayoutRoot);
- return value;
- }
-
- /// Handles changes to the property.
- private static void OnLayoutChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnLayoutChanged(e.OldValue as LayoutRoot, e.NewValue as LayoutRoot);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnLayoutChanged(LayoutRoot oldLayout, LayoutRoot newLayout)
- {
- if (oldLayout != null)
- {
- oldLayout.PropertyChanged -= OnLayoutRootPropertyChanged;
- oldLayout.Updated -= OnLayoutRootUpdated;
- }
-
- foreach (var fwc in _fwList.ToArray())
- {
- fwc.KeepContentVisibleOnClose = true;
- fwc.InternalClose();
- }
-
- _fwList.Clear();
-
- foreach (var fwc in _fwHiddenList.ToArray())
- {
- fwc.InternalClose();
- }
-
- _fwHiddenList.Clear();
- DetachDocumentsSource(oldLayout, DocumentsSource);
- DetachAnchorablesSource(oldLayout, AnchorablesSource);
-
- if (oldLayout != null && oldLayout.Manager == this)
- oldLayout.Manager = null;
-
- ClearLogicalChildrenList();
- DetachLayoutItems();
-
- Layout.Manager = this;
-
- AttachLayoutItems();
- AttachDocumentsSource(newLayout, DocumentsSource);
- AttachAnchorablesSource(newLayout, AnchorablesSource);
-
- if (IsLoaded)
- {
- LayoutRootPanel = CreateUIElementForModel(Layout.RootPanel) as LayoutPanelControl;
- LeftSidePanel = CreateUIElementForModel(Layout.LeftSide) as LayoutAnchorSideControl;
- TopSidePanel = CreateUIElementForModel(Layout.TopSide) as LayoutAnchorSideControl;
- RightSidePanel = CreateUIElementForModel(Layout.RightSide) as LayoutAnchorSideControl;
- BottomSidePanel = CreateUIElementForModel(Layout.BottomSide) as LayoutAnchorSideControl;
-
- foreach (var fw in Layout.FloatingWindows.ToArray())
- if (fw.IsValid)
- _fwList.Add(CreateUIElementForModel(fw) as LayoutFloatingWindowControl);
-
- foreach (var fw in _fwList.ToArray())
- {
- if (fw.Model is LayoutAnchorableFloatingWindow window && window.RootPanel.IsMaximized)
- {
- fw.WindowState = WindowState.Normal;
- fw.Show();
- fw.WindowState = WindowState.Maximized;
- }
- else
- {
- if (fw.Content != null || (fw.Model as LayoutAnchorableFloatingWindow)?.IsVisible == true)
- fw.Show();
- else
- fw.Hide();
- }
-
- //fw.Owner = Window.GetWindow(this);
- //fw.SetParentToMainWindowOf(this);
- }
-
- // In order to prevent resource leaks, unsubscribe from SizeChanged event for case when user call loading of Layout Settigns.
- SizeChanged -= OnSizeChanged;
- SizeChanged += OnSizeChanged;
- }
-
- if (newLayout != null)
- {
- newLayout.PropertyChanged += OnLayoutRootPropertyChanged;
- newLayout.Updated += OnLayoutRootUpdated;
- }
-
- LayoutChanged?.Invoke(this, EventArgs.Empty);
- // Layout?.CollectGarbage();
- CommandManager.InvalidateRequerySuggested();
- }
-
- #endregion Layout
-
- #region LayoutUpdateStrategy
-
- /// dependency property.
- public static readonly DependencyProperty LayoutUpdateStrategyProperty = DependencyProperty.Register(nameof(LayoutUpdateStrategy), typeof(ILayoutUpdateStrategy), typeof(DockingManager),
- new FrameworkPropertyMetadata((ILayoutUpdateStrategy)null));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates the strategy class to call when AvalonDock needs to positionate a LayoutAnchorable inside an existing layout.
- ///
- /// Sometimes it's impossible to automatically insert an anchorable in the layout without specifing the target parent pane.
- /// Set this property to an object that will be asked to insert the anchorable to the desidered position.
- public ILayoutUpdateStrategy LayoutUpdateStrategy
- {
- get => (ILayoutUpdateStrategy)GetValue(LayoutUpdateStrategyProperty);
- set => SetValue(LayoutUpdateStrategyProperty, value);
- }
-
- #endregion LayoutUpdateStrategy
-
- #region DocumentPaneTemplate
-
- /// dependency property.
- public static readonly DependencyProperty DocumentPaneTemplateProperty = DependencyProperty.Register(nameof(DocumentPaneTemplate), typeof(ControlTemplate), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnDocumentPaneTemplateChanged));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates .
- ///
- public ControlTemplate DocumentPaneTemplate
- {
- get => (ControlTemplate)GetValue(DocumentPaneTemplateProperty);
- set => SetValue(DocumentPaneTemplateProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnDocumentPaneTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- ((DockingManager)d).OnDocumentPaneTemplateChanged(e);
- }
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnDocumentPaneTemplateChanged(DependencyPropertyChangedEventArgs e)
- {
- }
-
- #endregion DocumentPaneTemplate
-
- #region AnchorablePaneTemplate
-
- ///
- /// dependency property
- ///
- public static readonly DependencyProperty AnchorablePaneTemplateProperty = DependencyProperty.Register(nameof(AnchorablePaneTemplate), typeof(ControlTemplate), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnAnchorablePaneTemplateChanged));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates ....
- ///
- public ControlTemplate AnchorablePaneTemplate
- {
- get => (ControlTemplate)GetValue(AnchorablePaneTemplateProperty);
- set => SetValue(AnchorablePaneTemplateProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnAnchorablePaneTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnAnchorablePaneTemplateChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnAnchorablePaneTemplateChanged(DependencyPropertyChangedEventArgs e)
- {
- }
-
- #endregion AnchorablePaneTemplate
-
- #region AnchorSideTemplate
-
- /// The dependency property.
- public static readonly DependencyProperty AnchorSideTemplateProperty = DependencyProperty.Register(nameof(AnchorSideTemplate), typeof(ControlTemplate), typeof(DockingManager),
- new FrameworkPropertyMetadata((ControlTemplate)null));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates ....
- ///
- public ControlTemplate AnchorSideTemplate
- {
- get => (ControlTemplate)GetValue(AnchorSideTemplateProperty);
- set => SetValue(AnchorSideTemplateProperty, value);
- }
-
- #endregion AnchorSideTemplate
-
- #region AnchorGroupTemplate
-
- /// dependency property.
- public static readonly DependencyProperty AnchorGroupTemplateProperty = DependencyProperty.Register(nameof(AnchorGroupTemplate), typeof(ControlTemplate), typeof(DockingManager),
- new FrameworkPropertyMetadata((ControlTemplate)null));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates the template used to render the AnchorGroup control.
- ///
- public ControlTemplate AnchorGroupTemplate
- {
- get => (ControlTemplate)GetValue(AnchorGroupTemplateProperty);
- set => SetValue(AnchorGroupTemplateProperty, value);
- }
-
- #endregion AnchorGroupTemplate
-
- #region AnchorTemplate
-
- /// dependency property.
- public static readonly DependencyProperty AnchorTemplateProperty = DependencyProperty.Register(nameof(AnchorTemplate), typeof(ControlTemplate), typeof(DockingManager),
- new FrameworkPropertyMetadata((ControlTemplate)null));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates ....
- ///
- public ControlTemplate AnchorTemplate
- {
- get => (ControlTemplate)GetValue(AnchorTemplateProperty);
- set => SetValue(AnchorTemplateProperty, value);
- }
-
- #endregion AnchorTemplate
-
- #region DocumentPaneControlStyle
-
- /// dependency property.
- public static readonly DependencyProperty DocumentPaneControlStyleProperty = DependencyProperty.Register(nameof(DocumentPaneControlStyle), typeof(Style), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnDocumentPaneControlStyleChanged));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates ....
- ///
- public Style DocumentPaneControlStyle
- {
- get => (Style)GetValue(DocumentPaneControlStyleProperty);
- set => SetValue(DocumentPaneControlStyleProperty, value);
- }
-
- /// Handles changes to the DocumentPaneControlStyle property.
- private static void OnDocumentPaneControlStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnDocumentPaneControlStyleChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnDocumentPaneControlStyleChanged(DependencyPropertyChangedEventArgs e)
- {
- }
-
- #endregion DocumentPaneControlStyle
-
- #region AnchorablePaneControlStyle
-
- /// dependency property.
- public static readonly DependencyProperty AnchorablePaneControlStyleProperty = DependencyProperty.Register(nameof(AnchorablePaneControlStyle), typeof(Style), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnAnchorablePaneControlStyleChanged));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates the style to apply to AnchorablePaneControl.
- ///
- public Style AnchorablePaneControlStyle
- {
- get => (Style)GetValue(AnchorablePaneControlStyleProperty);
- set => SetValue(AnchorablePaneControlStyleProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnAnchorablePaneControlStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnAnchorablePaneControlStyleChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnAnchorablePaneControlStyleChanged(DependencyPropertyChangedEventArgs e)
- {
- }
-
- #endregion AnchorablePaneControlStyle
-
- #region DocumentHeaderTemplate
-
- /// dependency property.
- public static readonly DependencyProperty DocumentHeaderTemplateProperty = DependencyProperty.Register(nameof(DocumentHeaderTemplate), typeof(DataTemplate), typeof(DockingManager),
- new FrameworkPropertyMetadata((DataTemplate)null, OnDocumentHeaderTemplateChanged, CoerceDocumentHeaderTemplateValue));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates data template to use for document header.
- ///
- public DataTemplate DocumentHeaderTemplate
- {
- get => (DataTemplate)GetValue(DocumentHeaderTemplateProperty);
- set => SetValue(DocumentHeaderTemplateProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnDocumentHeaderTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnDocumentHeaderTemplateChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnDocumentHeaderTemplateChanged(DependencyPropertyChangedEventArgs e)
- {
- }
-
- /// Coerces the value.
- private static object CoerceDocumentHeaderTemplateValue(DependencyObject d, object value)
- {
- if (value != null && d.GetValue(DocumentHeaderTemplateSelectorProperty) != null)
- return null;
- return value;
- }
-
- #endregion DocumentHeaderTemplate
-
- #region DocumentHeaderTemplateSelector
-
- /// dependency property.
- public static readonly DependencyProperty DocumentHeaderTemplateSelectorProperty = DependencyProperty.Register(nameof(DocumentHeaderTemplateSelector), typeof(DataTemplateSelector), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnDocumentHeaderTemplateSelectorChanged, CoerceDocumentHeaderTemplateSelectorValue));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates the template selector that is used when selecting the data template for the header.
- ///
- public DataTemplateSelector DocumentHeaderTemplateSelector
- {
- get => (DataTemplateSelector)GetValue(DocumentHeaderTemplateSelectorProperty);
- set => SetValue(DocumentHeaderTemplateSelectorProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnDocumentHeaderTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnDocumentHeaderTemplateSelectorChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnDocumentHeaderTemplateSelectorChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.NewValue != null && DocumentHeaderTemplate != null)
- DocumentHeaderTemplate = null;
- if (DocumentPaneMenuItemHeaderTemplateSelector == null)
- DocumentPaneMenuItemHeaderTemplateSelector = DocumentHeaderTemplateSelector;
- }
-
- /// Coerces the value.
- private static object CoerceDocumentHeaderTemplateSelectorValue(DependencyObject d, object value) => value;
-
- #endregion DocumentHeaderTemplateSelector
-
- #region DocumentTitleTemplate
-
- /// dependency property.
- public static readonly DependencyProperty DocumentTitleTemplateProperty = DependencyProperty.Register(nameof(DocumentTitleTemplate), typeof(DataTemplate), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnDocumentTitleTemplateChanged, CoerceDocumentTitleTemplateValue));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates the data template to use when creating the title for a document.
- ///
- public DataTemplate DocumentTitleTemplate
- {
- get => (DataTemplate)GetValue(DocumentTitleTemplateProperty);
- set => SetValue(DocumentTitleTemplateProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnDocumentTitleTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnDocumentTitleTemplateChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnDocumentTitleTemplateChanged(DependencyPropertyChangedEventArgs e)
- {
- }
-
- /// Coerces the value.
- private static object CoerceDocumentTitleTemplateValue(DependencyObject d, object value)
- {
- if (value != null && d.GetValue(DocumentTitleTemplateSelectorProperty) != null)
- return null;
- return value;
- }
-
- #endregion DocumentTitleTemplate
-
- #region DocumentTitleTemplateSelector
-
- /// dependency property.
- public static readonly DependencyProperty DocumentTitleTemplateSelectorProperty = DependencyProperty.Register(nameof(DocumentTitleTemplateSelector), typeof(DataTemplateSelector), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnDocumentTitleTemplateSelectorChanged, CoerceDocumentTitleTemplateSelectorValue));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates the data template selector to use when creating the data template for the title.
- ///
- public DataTemplateSelector DocumentTitleTemplateSelector
- {
- get => (DataTemplateSelector)GetValue(DocumentTitleTemplateSelectorProperty);
- set => SetValue(DocumentTitleTemplateSelectorProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnDocumentTitleTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnDocumentTitleTemplateSelectorChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnDocumentTitleTemplateSelectorChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.NewValue != null)
- DocumentTitleTemplate = null;
- }
-
- /// Coerces the value.
- private static object CoerceDocumentTitleTemplateSelectorValue(DependencyObject d, object value) => value;
-
- #endregion DocumentTitleTemplateSelector
-
- #region AnchorableTitleTemplate
-
- /// dependency property.
- public static readonly DependencyProperty AnchorableTitleTemplateProperty = DependencyProperty.Register(nameof(AnchorableTitleTemplate), typeof(DataTemplate), typeof(DockingManager),
- new FrameworkPropertyMetadata((DataTemplate)null, OnAnchorableTitleTemplateChanged, CoerceAnchorableTitleTemplateValue));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates the data template to use for anchorables title.
- ///
- public DataTemplate AnchorableTitleTemplate
- {
- get => (DataTemplate)GetValue(AnchorableTitleTemplateProperty);
- set => SetValue(AnchorableTitleTemplateProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnAnchorableTitleTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnAnchorableTitleTemplateChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnAnchorableTitleTemplateChanged(DependencyPropertyChangedEventArgs e)
- {
- }
-
- /// Coerces the value.
- private static object CoerceAnchorableTitleTemplateValue(DependencyObject d, object value)
- {
- if (value != null && d.GetValue(AnchorableTitleTemplateSelectorProperty) != null)
- return null;
- return value;
- }
-
- #endregion AnchorableTitleTemplate
-
- #region AnchorableTitleTemplateSelector
-
- /// dependency property.
- public static readonly DependencyProperty AnchorableTitleTemplateSelectorProperty = DependencyProperty.Register(nameof(AnchorableTitleTemplateSelector), typeof(DataTemplateSelector), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnAnchorableTitleTemplateSelectorChanged));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates which selector to use when selecting data template for the title of anchorables.
- ///
- public DataTemplateSelector AnchorableTitleTemplateSelector
- {
- get => (DataTemplateSelector)GetValue(AnchorableTitleTemplateSelectorProperty);
- set => SetValue(AnchorableTitleTemplateSelectorProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnAnchorableTitleTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnAnchorableTitleTemplateSelectorChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnAnchorableTitleTemplateSelectorChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.NewValue != null && AnchorableTitleTemplate != null)
- AnchorableTitleTemplate = null;
- }
-
- #endregion AnchorableTitleTemplateSelector
-
- #region AnchorableHeaderTemplate
-
- /// dependency property.
- public static readonly DependencyProperty AnchorableHeaderTemplateProperty = DependencyProperty.Register(nameof(AnchorableHeaderTemplate), typeof(DataTemplate), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnAnchorableHeaderTemplateChanged, CoerceAnchorableHeaderTemplateValue));
-
- /// Gets or sets the property. This dependency property indicates the data template to use for anchorable templates.
- public DataTemplate AnchorableHeaderTemplate
- {
- get => (DataTemplate)GetValue(AnchorableHeaderTemplateProperty);
- set => SetValue(AnchorableHeaderTemplateProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnAnchorableHeaderTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnAnchorableHeaderTemplateChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnAnchorableHeaderTemplateChanged(DependencyPropertyChangedEventArgs e)
- {
- }
-
- /// Coerces the value.
- private static object CoerceAnchorableHeaderTemplateValue(DependencyObject d, object value)
- {
- if (value != null && d.GetValue(AnchorableHeaderTemplateSelectorProperty) != null)
- return null;
- return value;
- }
-
- #endregion AnchorableHeaderTemplate
-
- #region AnchorableHeaderTemplateSelector
-
- /// dependency property.
- public static readonly DependencyProperty AnchorableHeaderTemplateSelectorProperty = DependencyProperty.Register(nameof(AnchorableHeaderTemplateSelector), typeof(DataTemplateSelector), typeof(DockingManager),
- new FrameworkPropertyMetadata((DataTemplateSelector)null, OnAnchorableHeaderTemplateSelectorChanged));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates the selector to use when selecting the data template for anchorable headers.
- ///
- public DataTemplateSelector AnchorableHeaderTemplateSelector
- {
- get => (DataTemplateSelector)GetValue(AnchorableHeaderTemplateSelectorProperty);
- set => SetValue(AnchorableHeaderTemplateSelectorProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnAnchorableHeaderTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnAnchorableHeaderTemplateSelectorChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnAnchorableHeaderTemplateSelectorChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.NewValue != null)
- AnchorableHeaderTemplate = null;
- }
+ Loaded += DockingManager_Loaded;
+ Unloaded += DockingManager_Unloaded;
+ }
+
+ #endregion Constructors
- #endregion AnchorableHeaderTemplateSelector
-
- #region LayoutRootPanel
-
- /// dependency property.
- public static readonly DependencyProperty LayoutRootPanelProperty = DependencyProperty.Register(nameof(LayoutRootPanel), typeof(LayoutPanelControl), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnLayoutRootPanelChanged));
-
- ///
- /// Gets or sets the property. This dependency property
- /// indicates the layout panel control which is attached to the Layout.Root property.
- ///
- public LayoutPanelControl LayoutRootPanel
- {
- get => (LayoutPanelControl)GetValue(LayoutRootPanelProperty);
- set => SetValue(LayoutRootPanelProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnLayoutRootPanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnLayoutRootPanelChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnLayoutRootPanelChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.OldValue != null)
- InternalRemoveLogicalChild(e.OldValue);
- if (e.NewValue != null)
- InternalAddLogicalChild(e.NewValue);
- }
-
- #endregion LayoutRootPanel
-
- #region RightSidePanel
-
- /// dependency property.
- public static readonly DependencyProperty RightSidePanelProperty = DependencyProperty.Register(nameof(RightSidePanel), typeof(LayoutAnchorSideControl), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnRightSidePanelChanged));
-
- /// Gets or sets the property. This dependency property indicates right side anchor panel.
- public LayoutAnchorSideControl RightSidePanel
- {
- get => (LayoutAnchorSideControl)GetValue(RightSidePanelProperty);
- set => SetValue(RightSidePanelProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnRightSidePanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnRightSidePanelChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnRightSidePanelChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.OldValue != null)
- InternalRemoveLogicalChild(e.OldValue);
- if (e.NewValue != null)
- InternalAddLogicalChild(e.NewValue);
- }
-
- #endregion RightSidePanel
-
- #region LeftSidePanel
-
- /// dependency property.
- public static readonly DependencyProperty LeftSidePanelProperty = DependencyProperty.Register(nameof(LeftSidePanel), typeof(LayoutAnchorSideControl), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnLeftSidePanelChanged));
-
- /// Gets or sets the property. This dependency property indicates the left side panel control.
- public LayoutAnchorSideControl LeftSidePanel
- {
- get => (LayoutAnchorSideControl)GetValue(LeftSidePanelProperty);
- set => SetValue(LeftSidePanelProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnLeftSidePanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnLeftSidePanelChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnLeftSidePanelChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.OldValue != null)
- InternalRemoveLogicalChild(e.OldValue);
- if (e.NewValue != null)
- InternalAddLogicalChild(e.NewValue);
- }
-
- #endregion LeftSidePanel
-
- #region TopSidePanel
-
- /// dependency property.
- public static readonly DependencyProperty TopSidePanelProperty = DependencyProperty.Register(nameof(TopSidePanel), typeof(LayoutAnchorSideControl), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnTopSidePanelChanged));
-
- /// Gets or sets the property. This dependency property indicates top side control panel.
- public LayoutAnchorSideControl TopSidePanel
- {
- get => (LayoutAnchorSideControl)GetValue(TopSidePanelProperty);
- set => SetValue(TopSidePanelProperty, value);
- }
-
- /// Handles changes to the property.
- private static void OnTopSidePanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnTopSidePanelChanged(e);
-
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnTopSidePanelChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.OldValue != null)
- InternalRemoveLogicalChild(e.OldValue);
- if (e.NewValue != null)
- InternalAddLogicalChild(e.NewValue);
- }
-
- #endregion TopSidePanel
-
- #region BottomSidePanel
-
- /// dependency property.
- public static readonly DependencyProperty BottomSidePanelProperty = DependencyProperty.Register(nameof(BottomSidePanel), typeof(LayoutAnchorSideControl), typeof(DockingManager),
- new FrameworkPropertyMetadata(null, OnBottomSidePanelChanged));
-
- /// Gets or sets the property. This dependency property indicates bottom side panel control.
- public LayoutAnchorSideControl BottomSidePanel
- {
- get => (LayoutAnchorSideControl)GetValue(BottomSidePanelProperty);
- set => SetValue(BottomSidePanelProperty, value);
- }
+ #region Events
+
+ /// Event fired when property changes.
+ ///
+ public event EventHandler LayoutChanged;
+
+ /// Event fired when property is about to be changed.
+ ///
+ public event EventHandler LayoutChanging;
+
+ /// Event fired when a document is about to be closed.
+ /// Subscribers have the opportunity to cancel the operation.
+ public event EventHandler DocumentClosing;
+
+ /// Event fired after a document is closed.
+ public event EventHandler DocumentClosed;
+
+ /// Event is raised when changes.
+ ///
+ public event EventHandler ActiveContentChanged;
+
+ #endregion Events
+
+ #region Public Properties
+
+ #region Layout
+
+ /// dependency property.
+ public static readonly DependencyProperty LayoutProperty = DependencyProperty.Register(nameof(Layout), typeof(LayoutRoot), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnLayoutChanged, CoerceLayoutValue));
+
+ /// Gets or sets the property. This dependency property indicates layout tree.
+ public LayoutRoot Layout
+ {
+ get => (LayoutRoot)GetValue(LayoutProperty);
+ set => SetValue(LayoutProperty, value);
+ }
+
+ /// Coerces the value.
+ private static object CoerceLayoutValue(DependencyObject d, object value)
+ {
+ if (value == null) return new LayoutRoot { RootPanel = new LayoutPanel(new LayoutDocumentPaneGroup(new LayoutDocumentPane())) };
+ ((DockingManager)d).OnLayoutChanging(value as LayoutRoot);
+ return value;
+ }
+
+ /// Handles changes to the property.
+ private static void OnLayoutChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnLayoutChanged(e.OldValue as LayoutRoot, e.NewValue as LayoutRoot);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnLayoutChanged(LayoutRoot oldLayout, LayoutRoot newLayout)
+ {
+ if (oldLayout != null)
+ {
+ oldLayout.PropertyChanged -= OnLayoutRootPropertyChanged;
+ oldLayout.Updated -= OnLayoutRootUpdated;
+ }
+
+ foreach (var fwc in _fwList.ToArray())
+ {
+ fwc.KeepContentVisibleOnClose = true;
+ fwc.InternalClose();
+ }
+
+ _fwList.Clear();
+
+ foreach (var fwc in _fwHiddenList.ToArray())
+ {
+ fwc.InternalClose();
+ }
+
+ _fwHiddenList.Clear();
+ DetachDocumentsSource(oldLayout, DocumentsSource);
+ DetachAnchorablesSource(oldLayout, AnchorablesSource);
+
+ if (oldLayout != null && oldLayout.Manager == this)
+ oldLayout.Manager = null;
+
+ ClearLogicalChildrenList();
+ DetachLayoutItems();
+
+ Layout.Manager = this;
+
+ AttachLayoutItems();
+ AttachDocumentsSource(newLayout, DocumentsSource);
+ AttachAnchorablesSource(newLayout, AnchorablesSource);
+
+ if (IsLoaded)
+ {
+ LayoutRootPanel = CreateUIElementForModel(Layout.RootPanel) as LayoutPanelControl;
+ LeftSidePanel = CreateUIElementForModel(Layout.LeftSide) as LayoutAnchorSideControl;
+ TopSidePanel = CreateUIElementForModel(Layout.TopSide) as LayoutAnchorSideControl;
+ RightSidePanel = CreateUIElementForModel(Layout.RightSide) as LayoutAnchorSideControl;
+ BottomSidePanel = CreateUIElementForModel(Layout.BottomSide) as LayoutAnchorSideControl;
+
+ foreach (var fw in Layout.FloatingWindows.ToArray())
+ if (fw.IsValid)
+ _fwList.Add(CreateUIElementForModel(fw) as LayoutFloatingWindowControl);
+
+ foreach (var fw in _fwList.ToArray())
+ {
+ if (fw.Model is LayoutAnchorableFloatingWindow window && window.RootPanel.IsMaximized)
+ {
+ fw.WindowState = WindowState.Normal;
+ fw.Show();
+ fw.WindowState = WindowState.Maximized;
+ }
+ else
+ {
+ if (fw.Content != null || (fw.Model as LayoutAnchorableFloatingWindow)?.IsVisible == true)
+ fw.Show();
+ else
+ fw.Hide();
+ }
+
+ //fw.Owner = Window.GetWindow(this);
+ //fw.SetParentToMainWindowOf(this);
+ }
+
+ // In order to prevent resource leaks, unsubscribe from SizeChanged event for case when user call loading of Layout Settigns.
+ SizeChanged -= OnSizeChanged;
+ SizeChanged += OnSizeChanged;
+ }
+
+ if (newLayout != null)
+ {
+ newLayout.PropertyChanged += OnLayoutRootPropertyChanged;
+ newLayout.Updated += OnLayoutRootUpdated;
+ }
+
+ LayoutChanged?.Invoke(this, EventArgs.Empty);
+ // Layout?.CollectGarbage();
+ CommandManager.InvalidateRequerySuggested();
+ }
+
+ #endregion Layout
+
+ #region LayoutUpdateStrategy
+
+ /// dependency property.
+ public static readonly DependencyProperty LayoutUpdateStrategyProperty = DependencyProperty.Register(nameof(LayoutUpdateStrategy), typeof(ILayoutUpdateStrategy), typeof(DockingManager),
+ new FrameworkPropertyMetadata((ILayoutUpdateStrategy)null));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates the strategy class to call when AvalonDock needs to positionate a LayoutAnchorable inside an existing layout.
+ ///
+ /// Sometimes it's impossible to automatically insert an anchorable in the layout without specifing the target parent pane.
+ /// Set this property to an object that will be asked to insert the anchorable to the desidered position.
+ public ILayoutUpdateStrategy LayoutUpdateStrategy
+ {
+ get => (ILayoutUpdateStrategy)GetValue(LayoutUpdateStrategyProperty);
+ set => SetValue(LayoutUpdateStrategyProperty, value);
+ }
+
+ #endregion LayoutUpdateStrategy
+
+ #region DocumentPaneTemplate
+
+ /// dependency property.
+ public static readonly DependencyProperty DocumentPaneTemplateProperty = DependencyProperty.Register(nameof(DocumentPaneTemplate), typeof(ControlTemplate), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnDocumentPaneTemplateChanged));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates .
+ ///
+ public ControlTemplate DocumentPaneTemplate
+ {
+ get => (ControlTemplate)GetValue(DocumentPaneTemplateProperty);
+ set => SetValue(DocumentPaneTemplateProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnDocumentPaneTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ((DockingManager)d).OnDocumentPaneTemplateChanged(e);
+ }
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnDocumentPaneTemplateChanged(DependencyPropertyChangedEventArgs e)
+ {
+ }
+
+ #endregion DocumentPaneTemplate
+
+ #region AnchorablePaneTemplate
+
+ ///
+ /// dependency property
+ ///
+ public static readonly DependencyProperty AnchorablePaneTemplateProperty = DependencyProperty.Register(nameof(AnchorablePaneTemplate), typeof(ControlTemplate), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnAnchorablePaneTemplateChanged));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates ....
+ ///
+ public ControlTemplate AnchorablePaneTemplate
+ {
+ get => (ControlTemplate)GetValue(AnchorablePaneTemplateProperty);
+ set => SetValue(AnchorablePaneTemplateProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnAnchorablePaneTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnAnchorablePaneTemplateChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnAnchorablePaneTemplateChanged(DependencyPropertyChangedEventArgs e)
+ {
+ }
+
+ #endregion AnchorablePaneTemplate
+
+ #region AnchorSideTemplate
+
+ /// The dependency property.
+ public static readonly DependencyProperty AnchorSideTemplateProperty = DependencyProperty.Register(nameof(AnchorSideTemplate), typeof(ControlTemplate), typeof(DockingManager),
+ new FrameworkPropertyMetadata((ControlTemplate)null));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates ....
+ ///
+ public ControlTemplate AnchorSideTemplate
+ {
+ get => (ControlTemplate)GetValue(AnchorSideTemplateProperty);
+ set => SetValue(AnchorSideTemplateProperty, value);
+ }
+
+ #endregion AnchorSideTemplate
+
+ #region AnchorGroupTemplate
+
+ /// dependency property.
+ public static readonly DependencyProperty AnchorGroupTemplateProperty = DependencyProperty.Register(nameof(AnchorGroupTemplate), typeof(ControlTemplate), typeof(DockingManager),
+ new FrameworkPropertyMetadata((ControlTemplate)null));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates the template used to render the AnchorGroup control.
+ ///
+ public ControlTemplate AnchorGroupTemplate
+ {
+ get => (ControlTemplate)GetValue(AnchorGroupTemplateProperty);
+ set => SetValue(AnchorGroupTemplateProperty, value);
+ }
+
+ #endregion AnchorGroupTemplate
+
+ #region AnchorTemplate
+
+ /// dependency property.
+ public static readonly DependencyProperty AnchorTemplateProperty = DependencyProperty.Register(nameof(AnchorTemplate), typeof(ControlTemplate), typeof(DockingManager),
+ new FrameworkPropertyMetadata((ControlTemplate)null));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates ....
+ ///
+ public ControlTemplate AnchorTemplate
+ {
+ get => (ControlTemplate)GetValue(AnchorTemplateProperty);
+ set => SetValue(AnchorTemplateProperty, value);
+ }
+
+ #endregion AnchorTemplate
+
+ #region DocumentPaneControlStyle
+
+ /// dependency property.
+ public static readonly DependencyProperty DocumentPaneControlStyleProperty = DependencyProperty.Register(nameof(DocumentPaneControlStyle), typeof(Style), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnDocumentPaneControlStyleChanged));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates ....
+ ///
+ public Style DocumentPaneControlStyle
+ {
+ get => (Style)GetValue(DocumentPaneControlStyleProperty);
+ set => SetValue(DocumentPaneControlStyleProperty, value);
+ }
+
+ /// Handles changes to the DocumentPaneControlStyle property.
+ private static void OnDocumentPaneControlStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnDocumentPaneControlStyleChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnDocumentPaneControlStyleChanged(DependencyPropertyChangedEventArgs e)
+ {
+ }
+
+ #endregion DocumentPaneControlStyle
+
+ #region AnchorablePaneControlStyle
+
+ /// dependency property.
+ public static readonly DependencyProperty AnchorablePaneControlStyleProperty = DependencyProperty.Register(nameof(AnchorablePaneControlStyle), typeof(Style), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnAnchorablePaneControlStyleChanged));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates the style to apply to AnchorablePaneControl.
+ ///
+ public Style AnchorablePaneControlStyle
+ {
+ get => (Style)GetValue(AnchorablePaneControlStyleProperty);
+ set => SetValue(AnchorablePaneControlStyleProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnAnchorablePaneControlStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnAnchorablePaneControlStyleChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnAnchorablePaneControlStyleChanged(DependencyPropertyChangedEventArgs e)
+ {
+ }
+
+ #endregion AnchorablePaneControlStyle
+
+ #region DocumentHeaderTemplate
+
+ /// dependency property.
+ public static readonly DependencyProperty DocumentHeaderTemplateProperty = DependencyProperty.Register(nameof(DocumentHeaderTemplate), typeof(DataTemplate), typeof(DockingManager),
+ new FrameworkPropertyMetadata((DataTemplate)null, OnDocumentHeaderTemplateChanged, CoerceDocumentHeaderTemplateValue));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates data template to use for document header.
+ ///
+ public DataTemplate DocumentHeaderTemplate
+ {
+ get => (DataTemplate)GetValue(DocumentHeaderTemplateProperty);
+ set => SetValue(DocumentHeaderTemplateProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnDocumentHeaderTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnDocumentHeaderTemplateChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnDocumentHeaderTemplateChanged(DependencyPropertyChangedEventArgs e)
+ {
+ }
+
+ /// Coerces the value.
+ private static object CoerceDocumentHeaderTemplateValue(DependencyObject d, object value)
+ {
+ if (value != null && d.GetValue(DocumentHeaderTemplateSelectorProperty) != null)
+ return null;
+ return value;
+ }
+
+ #endregion DocumentHeaderTemplate
+
+ #region DocumentHeaderTemplateSelector
+
+ /// dependency property.
+ public static readonly DependencyProperty DocumentHeaderTemplateSelectorProperty = DependencyProperty.Register(nameof(DocumentHeaderTemplateSelector), typeof(DataTemplateSelector), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnDocumentHeaderTemplateSelectorChanged, CoerceDocumentHeaderTemplateSelectorValue));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates the template selector that is used when selecting the data template for the header.
+ ///
+ public DataTemplateSelector DocumentHeaderTemplateSelector
+ {
+ get => (DataTemplateSelector)GetValue(DocumentHeaderTemplateSelectorProperty);
+ set => SetValue(DocumentHeaderTemplateSelectorProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnDocumentHeaderTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnDocumentHeaderTemplateSelectorChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnDocumentHeaderTemplateSelectorChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (e.NewValue != null && DocumentHeaderTemplate != null)
+ DocumentHeaderTemplate = null;
+ if (DocumentPaneMenuItemHeaderTemplateSelector == null)
+ DocumentPaneMenuItemHeaderTemplateSelector = DocumentHeaderTemplateSelector;
+ }
+
+ /// Coerces the value.
+ private static object CoerceDocumentHeaderTemplateSelectorValue(DependencyObject d, object value) => value;
+
+ #endregion DocumentHeaderTemplateSelector
+
+ #region DocumentTitleTemplate
+
+ /// dependency property.
+ public static readonly DependencyProperty DocumentTitleTemplateProperty = DependencyProperty.Register(nameof(DocumentTitleTemplate), typeof(DataTemplate), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnDocumentTitleTemplateChanged, CoerceDocumentTitleTemplateValue));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates the data template to use when creating the title for a document.
+ ///
+ public DataTemplate DocumentTitleTemplate
+ {
+ get => (DataTemplate)GetValue(DocumentTitleTemplateProperty);
+ set => SetValue(DocumentTitleTemplateProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnDocumentTitleTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnDocumentTitleTemplateChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnDocumentTitleTemplateChanged(DependencyPropertyChangedEventArgs e)
+ {
+ }
+
+ /// Coerces the value.
+ private static object CoerceDocumentTitleTemplateValue(DependencyObject d, object value)
+ {
+ if (value != null && d.GetValue(DocumentTitleTemplateSelectorProperty) != null)
+ return null;
+ return value;
+ }
+
+ #endregion DocumentTitleTemplate
+
+ #region DocumentTitleTemplateSelector
+
+ /// dependency property.
+ public static readonly DependencyProperty DocumentTitleTemplateSelectorProperty = DependencyProperty.Register(nameof(DocumentTitleTemplateSelector), typeof(DataTemplateSelector), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnDocumentTitleTemplateSelectorChanged, CoerceDocumentTitleTemplateSelectorValue));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates the data template selector to use when creating the data template for the title.
+ ///
+ public DataTemplateSelector DocumentTitleTemplateSelector
+ {
+ get => (DataTemplateSelector)GetValue(DocumentTitleTemplateSelectorProperty);
+ set => SetValue(DocumentTitleTemplateSelectorProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnDocumentTitleTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnDocumentTitleTemplateSelectorChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnDocumentTitleTemplateSelectorChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (e.NewValue != null)
+ DocumentTitleTemplate = null;
+ }
+
+ /// Coerces the value.
+ private static object CoerceDocumentTitleTemplateSelectorValue(DependencyObject d, object value) => value;
+
+ #endregion DocumentTitleTemplateSelector
+
+ #region AnchorableTitleTemplate
+
+ /// dependency property.
+ public static readonly DependencyProperty AnchorableTitleTemplateProperty = DependencyProperty.Register(nameof(AnchorableTitleTemplate), typeof(DataTemplate), typeof(DockingManager),
+ new FrameworkPropertyMetadata((DataTemplate)null, OnAnchorableTitleTemplateChanged, CoerceAnchorableTitleTemplateValue));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates the data template to use for anchorables title.
+ ///
+ public DataTemplate AnchorableTitleTemplate
+ {
+ get => (DataTemplate)GetValue(AnchorableTitleTemplateProperty);
+ set => SetValue(AnchorableTitleTemplateProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnAnchorableTitleTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnAnchorableTitleTemplateChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnAnchorableTitleTemplateChanged(DependencyPropertyChangedEventArgs e)
+ {
+ }
+
+ /// Coerces the value.
+ private static object CoerceAnchorableTitleTemplateValue(DependencyObject d, object value)
+ {
+ if (value != null && d.GetValue(AnchorableTitleTemplateSelectorProperty) != null)
+ return null;
+ return value;
+ }
+
+ #endregion AnchorableTitleTemplate
+
+ #region AnchorableTitleTemplateSelector
+
+ /// dependency property.
+ public static readonly DependencyProperty AnchorableTitleTemplateSelectorProperty = DependencyProperty.Register(nameof(AnchorableTitleTemplateSelector), typeof(DataTemplateSelector), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnAnchorableTitleTemplateSelectorChanged));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates which selector to use when selecting data template for the title of anchorables.
+ ///
+ public DataTemplateSelector AnchorableTitleTemplateSelector
+ {
+ get => (DataTemplateSelector)GetValue(AnchorableTitleTemplateSelectorProperty);
+ set => SetValue(AnchorableTitleTemplateSelectorProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnAnchorableTitleTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnAnchorableTitleTemplateSelectorChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnAnchorableTitleTemplateSelectorChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (e.NewValue != null && AnchorableTitleTemplate != null)
+ AnchorableTitleTemplate = null;
+ }
+
+ #endregion AnchorableTitleTemplateSelector
+
+ #region AnchorableHeaderTemplate
+
+ /// dependency property.
+ public static readonly DependencyProperty AnchorableHeaderTemplateProperty = DependencyProperty.Register(nameof(AnchorableHeaderTemplate), typeof(DataTemplate), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnAnchorableHeaderTemplateChanged, CoerceAnchorableHeaderTemplateValue));
+
+ /// Gets or sets the property. This dependency property indicates the data template to use for anchorable templates.
+ public DataTemplate AnchorableHeaderTemplate
+ {
+ get => (DataTemplate)GetValue(AnchorableHeaderTemplateProperty);
+ set => SetValue(AnchorableHeaderTemplateProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnAnchorableHeaderTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnAnchorableHeaderTemplateChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnAnchorableHeaderTemplateChanged(DependencyPropertyChangedEventArgs e)
+ {
+ }
+
+ /// Coerces the value.
+ private static object CoerceAnchorableHeaderTemplateValue(DependencyObject d, object value)
+ {
+ if (value != null && d.GetValue(AnchorableHeaderTemplateSelectorProperty) != null)
+ return null;
+ return value;
+ }
+
+ #endregion AnchorableHeaderTemplate
+
+ #region AnchorableHeaderTemplateSelector
+
+ /// dependency property.
+ public static readonly DependencyProperty AnchorableHeaderTemplateSelectorProperty = DependencyProperty.Register(nameof(AnchorableHeaderTemplateSelector), typeof(DataTemplateSelector), typeof(DockingManager),
+ new FrameworkPropertyMetadata((DataTemplateSelector)null, OnAnchorableHeaderTemplateSelectorChanged));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates the selector to use when selecting the data template for anchorable headers.
+ ///
+ public DataTemplateSelector AnchorableHeaderTemplateSelector
+ {
+ get => (DataTemplateSelector)GetValue(AnchorableHeaderTemplateSelectorProperty);
+ set => SetValue(AnchorableHeaderTemplateSelectorProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnAnchorableHeaderTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnAnchorableHeaderTemplateSelectorChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnAnchorableHeaderTemplateSelectorChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (e.NewValue != null)
+ AnchorableHeaderTemplate = null;
+ }
+
+ #endregion AnchorableHeaderTemplateSelector
+
+ #region LayoutRootPanel
+
+ /// dependency property.
+ public static readonly DependencyProperty LayoutRootPanelProperty = DependencyProperty.Register(nameof(LayoutRootPanel), typeof(LayoutPanelControl), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnLayoutRootPanelChanged));
+
+ ///
+ /// Gets or sets the property. This dependency property
+ /// indicates the layout panel control which is attached to the Layout.Root property.
+ ///
+ public LayoutPanelControl LayoutRootPanel
+ {
+ get => (LayoutPanelControl)GetValue(LayoutRootPanelProperty);
+ set => SetValue(LayoutRootPanelProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnLayoutRootPanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnLayoutRootPanelChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnLayoutRootPanelChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (e.OldValue != null)
+ InternalRemoveLogicalChild(e.OldValue);
+ if (e.NewValue != null)
+ InternalAddLogicalChild(e.NewValue);
+ }
+
+ #endregion LayoutRootPanel
+
+ #region RightSidePanel
+
+ /// dependency property.
+ public static readonly DependencyProperty RightSidePanelProperty = DependencyProperty.Register(nameof(RightSidePanel), typeof(LayoutAnchorSideControl), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnRightSidePanelChanged));
+
+ /// Gets or sets the property. This dependency property indicates right side anchor panel.
+ public LayoutAnchorSideControl RightSidePanel
+ {
+ get => (LayoutAnchorSideControl)GetValue(RightSidePanelProperty);
+ set => SetValue(RightSidePanelProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnRightSidePanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnRightSidePanelChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnRightSidePanelChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (e.OldValue != null)
+ InternalRemoveLogicalChild(e.OldValue);
+ if (e.NewValue != null)
+ InternalAddLogicalChild(e.NewValue);
+ }
+
+ #endregion RightSidePanel
+
+ #region LeftSidePanel
+
+ /// dependency property.
+ public static readonly DependencyProperty LeftSidePanelProperty = DependencyProperty.Register(nameof(LeftSidePanel), typeof(LayoutAnchorSideControl), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnLeftSidePanelChanged));
+
+ /// Gets or sets the property. This dependency property indicates the left side panel control.
+ public LayoutAnchorSideControl LeftSidePanel
+ {
+ get => (LayoutAnchorSideControl)GetValue(LeftSidePanelProperty);
+ set => SetValue(LeftSidePanelProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnLeftSidePanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnLeftSidePanelChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnLeftSidePanelChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (e.OldValue != null)
+ InternalRemoveLogicalChild(e.OldValue);
+ if (e.NewValue != null)
+ InternalAddLogicalChild(e.NewValue);
+ }
+
+ #endregion LeftSidePanel
+
+ #region TopSidePanel
+
+ /// dependency property.
+ public static readonly DependencyProperty TopSidePanelProperty = DependencyProperty.Register(nameof(TopSidePanel), typeof(LayoutAnchorSideControl), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnTopSidePanelChanged));
+
+ /// Gets or sets the property. This dependency property indicates top side control panel.
+ public LayoutAnchorSideControl TopSidePanel
+ {
+ get => (LayoutAnchorSideControl)GetValue(TopSidePanelProperty);
+ set => SetValue(TopSidePanelProperty, value);
+ }
+
+ /// Handles changes to the property.
+ private static void OnTopSidePanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnTopSidePanelChanged(e);
+
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnTopSidePanelChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (e.OldValue != null)
+ InternalRemoveLogicalChild(e.OldValue);
+ if (e.NewValue != null)
+ InternalAddLogicalChild(e.NewValue);
+ }
+
+ #endregion TopSidePanel
+
+ #region BottomSidePanel
+
+ /// dependency property.
+ public static readonly DependencyProperty BottomSidePanelProperty = DependencyProperty.Register(nameof(BottomSidePanel), typeof(LayoutAnchorSideControl), typeof(DockingManager),
+ new FrameworkPropertyMetadata(null, OnBottomSidePanelChanged));
+
+ /// Gets or sets the property. This dependency property indicates bottom side panel control.
+ public LayoutAnchorSideControl BottomSidePanel
+ {
+ get => (LayoutAnchorSideControl)GetValue(BottomSidePanelProperty);
+ set => SetValue(BottomSidePanelProperty, value);
+ }
- /// Handles changes to the property.
- private static void OnBottomSidePanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnBottomSidePanelChanged(e);
+ /// Handles changes to the property.
+ private static void OnBottomSidePanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((DockingManager)d).OnBottomSidePanelChanged(e);
- /// Provides derived classes an opportunity to handle changes to the property.
- protected virtual void OnBottomSidePanelChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.OldValue != null)
- InternalRemoveLogicalChild(e.OldValue);
- if (e.NewValue != null)
- InternalAddLogicalChild(e.NewValue);
- }
+ /// Provides derived classes an opportunity to handle changes to the property.
+ protected virtual void OnBottomSidePanelChanged(DependencyPropertyChangedEventArgs e)
+ {
+ if (e.OldValue != null)
+ InternalRemoveLogicalChild(e.OldValue);
+ if (e.NewValue != null)
+ InternalAddLogicalChild(e.NewValue);
+ }
- #endregion BottomSidePanel
-
- #region LogicalChildren
+ #endregion BottomSidePanel
+
+ #region LogicalChildren
- List _logicalChildren = new List();
+ private readonly List _logicalChildren = new List();
- ///
- protected override IEnumerator LogicalChildren => _logicalChildren.Select(ch => ch.GetValueOrDefault
public const string ToolTitle = "File Stats";
- private IWorkSpaceViewModel _workSpaceViewModel = null;
+ private readonly IWorkSpaceViewModel _workSpaceViewModel = null;
private DateTime _lastModified;
private long _fileSize;
diff --git a/source/MLibTest/MLibTest/MainWindow.xaml b/source/MLibTest/MLibTest/MainWindow.xaml
index 19ba3993..780c084c 100644
--- a/source/MLibTest/MLibTest/MainWindow.xaml
+++ b/source/MLibTest/MLibTest/MainWindow.xaml
@@ -1,204 +1,215 @@
-
-
-
-
-
-
-
-
-
-
+ x:Class="MLibTest.MainWindow"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:MWindow="clr-namespace:MWindowLib;assembly=MWindowLib"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:demos="clr-namespace:MLibTest.Demos"
+ xmlns:demoviews="clr-namespace:MLibTest.Demos.Views"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ x:Name="mainWindow"
+ Title="MainWindow"
+ mc:Ignorable="d">
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/MLibTest/MLibTest_Components/Settings/Settings/Settings.csproj b/source/MLibTest/MLibTest_Components/Settings/Settings/Settings.csproj
index bffb5ccb..c00df423 100644
--- a/source/MLibTest/MLibTest_Components/Settings/Settings/Settings.csproj
+++ b/source/MLibTest/MLibTest_Components/Settings/Settings/Settings.csproj
@@ -106,6 +106,9 @@
+
+ .editorconfig
+
diff --git a/source/MVVMTestApp/App.xaml b/source/MVVMTestApp/App.xaml
index c087d643..3cd782e8 100644
--- a/source/MVVMTestApp/App.xaml
+++ b/source/MVVMTestApp/App.xaml
@@ -1,8 +1,10 @@
-
-
-
-
+
+
+
+
diff --git a/source/MVVMTestApp/MVVMTestApp.csproj b/source/MVVMTestApp/MVVMTestApp.csproj
index 5bb78ef0..147851a2 100644
--- a/source/MVVMTestApp/MVVMTestApp.csproj
+++ b/source/MVVMTestApp/MVVMTestApp.csproj
@@ -12,6 +12,11 @@
+
+
+
+
+
diff --git a/source/MVVMTestApp/MainWindow.xaml b/source/MVVMTestApp/MainWindow.xaml
index 4fd63b39..7708e4c2 100644
--- a/source/MVVMTestApp/MainWindow.xaml
+++ b/source/MVVMTestApp/MainWindow.xaml
@@ -1,117 +1,122 @@
-
-
- True
- False
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/MVVMTestApp/MainWindow.xaml.cs b/source/MVVMTestApp/MainWindow.xaml.cs
index f11bae09..4129791d 100644
--- a/source/MVVMTestApp/MainWindow.xaml.cs
+++ b/source/MVVMTestApp/MainWindow.xaml.cs
@@ -60,19 +60,19 @@ public ICommand LoadLayoutCommand
{
if (_loadLayoutCommand == null)
{
- _loadLayoutCommand = new RelayCommand((p) => OnLoadLayout(p), (p) => CanLoadLayout(p));
+ _loadLayoutCommand = new RelayCommand((p) => OnLoadLayout(), (p) => CanLoadLayout());
}
return _loadLayoutCommand;
}
}
- private bool CanLoadLayout(object parameter)
+ private bool CanLoadLayout()
{
return File.Exists(@".\AvalonDock.Layout.config");
}
- private void OnLoadLayout(object parameter)
+ private void OnLoadLayout()
{
var layoutSerializer = new XmlLayoutSerializer(dockManager);
@@ -103,19 +103,19 @@ public ICommand SaveLayoutCommand
{
if (_saveLayoutCommand == null)
{
- _saveLayoutCommand = new RelayCommand((p) => OnSaveLayout(p), (p) => CanSaveLayout(p));
+ _saveLayoutCommand = new RelayCommand((p) => OnSaveLayout(), (p) => CanSaveLayout());
}
return _saveLayoutCommand;
}
}
- private bool CanSaveLayout(object parameter)
+ private bool CanSaveLayout()
{
return true;
}
- private void OnSaveLayout(object parameter)
+ private void OnSaveLayout()
{
var layoutSerializer = new XmlLayoutSerializer(dockManager);
layoutSerializer.Serialize(@".\AvalonDock.Layout.config");
diff --git a/source/MVVMTestApp/Workspace.cs b/source/MVVMTestApp/Workspace.cs
index 0f66fb4b..3ea348e5 100644
--- a/source/MVVMTestApp/Workspace.cs
+++ b/source/MVVMTestApp/Workspace.cs
@@ -6,178 +6,210 @@
using Microsoft.Win32;
using System.IO;
using System.Windows;
+using AvalonDock.Themes;
namespace AvalonDock.MVVMTestApp
{
- internal class Workspace : ViewModelBase
- {
- #region fields
- static Workspace _this = new Workspace();
-
- ToolViewModel[] _tools = null;
- private ObservableCollection _files = new ObservableCollection();
- private ReadOnlyObservableCollection _readonyFiles = null;
- private FileViewModel _activeDocument = null;
- FileStatsViewModel _fileStats = null;
- RelayCommand _openCommand = null;
- RelayCommand _newCommand = null;
- #endregion fields
-
- #region constructors
- ///
- /// Class constructor
- ///
- protected Workspace()
- {
- }
- #endregion constructors
-
- public event EventHandler ActiveDocumentChanged;
-
- #region properties
- public static Workspace This => _this;
-
- public ReadOnlyObservableCollection Files
- {
- get
- {
- if (_readonyFiles == null)
- _readonyFiles = new ReadOnlyObservableCollection(_files);
-
- return _readonyFiles;
- }
- }
-
- public IEnumerable Tools
- {
- get
- {
- if (_tools == null)
- _tools = new ToolViewModel[] { FileStats };
- return _tools;
- }
- }
-
- public FileStatsViewModel FileStats
- {
- get
- {
- if (_fileStats == null)
- _fileStats = new FileStatsViewModel();
-
- return _fileStats;
- }
- }
-
- public ICommand OpenCommand
- {
- get
- {
- if (_openCommand == null)
- {
- _openCommand = new RelayCommand((p) => OnOpen(p), (p) => CanOpen(p));
- }
-
- return _openCommand;
- }
- }
-
- public ICommand NewCommand
- {
- get
- {
- if (_newCommand == null)
- {
- _newCommand = new RelayCommand((p) => OnNew(p), (p) => CanNew(p));
- }
-
- return _newCommand;
- }
- }
-
- public FileViewModel ActiveDocument
- {
- get => _activeDocument;
- set
- {
- if (_activeDocument != value)
- {
- _activeDocument = value;
- RaisePropertyChanged(nameof(ActiveDocument));
- if (ActiveDocumentChanged != null)
- ActiveDocumentChanged(this, EventArgs.Empty);
- }
- }
- }
- #endregion properties
-
- #region methods
- internal void Close(FileViewModel fileToClose)
- {
- if (fileToClose.IsDirty)
- {
- var res = MessageBox.Show(string.Format("Save changes for file '{0}'?", fileToClose.FileName), "AvalonDock Test App", MessageBoxButton.YesNoCancel);
- if (res == MessageBoxResult.Cancel)
- return;
- if (res == MessageBoxResult.Yes)
- {
- Save(fileToClose);
- }
- }
-
- _files.Remove(fileToClose);
- }
-
- internal void Save(FileViewModel fileToSave, bool saveAsFlag = false)
- {
- if (fileToSave.FilePath == null || saveAsFlag)
- {
- var dlg = new SaveFileDialog();
- if (dlg.ShowDialog().GetValueOrDefault())
- fileToSave.FilePath = dlg.SafeFileName;
- }
-
- File.WriteAllText(fileToSave.FilePath, fileToSave.TextContent);
- ActiveDocument.IsDirty = false;
- }
-
- internal FileViewModel Open(string filepath)
- {
- var fileViewModel = _files.FirstOrDefault(fm => fm.FilePath == filepath);
- if (fileViewModel != null)
- return fileViewModel;
-
- fileViewModel = new FileViewModel(filepath);
- _files.Add(fileViewModel);
- return fileViewModel;
- }
-
- #region OpenCommand
- private bool CanOpen(object parameter) => true;
-
- private void OnOpen(object parameter)
- {
- var dlg = new OpenFileDialog();
- if (dlg.ShowDialog().GetValueOrDefault())
- {
- var fileViewModel = Open(dlg.FileName);
- ActiveDocument = fileViewModel;
- }
- }
- #endregion OpenCommand
-
- #region NewCommand
- private bool CanNew(object parameter)
- {
- return true;
- }
-
- private void OnNew(object parameter)
- {
- _files.Add(new FileViewModel());
- ActiveDocument = _files.Last();
- }
- #endregion
- #endregion methods
- }
+ internal class Workspace : ViewModelBase
+ {
+ #region fields
+ static Workspace _this = new Workspace();
+
+ ToolViewModel[] _tools = null;
+ private ObservableCollection _files = new ObservableCollection();
+ private ReadOnlyObservableCollection _readonyFiles = null;
+ private FileViewModel _activeDocument = null;
+ FileStatsViewModel _fileStats = null;
+ RelayCommand _openCommand = null;
+ RelayCommand _newCommand = null;
+ private Tuple selectedTheme;
+ #endregion fields
+
+ #region constructors
+ ///
+ /// Class constructor
+ ///
+ protected Workspace()
+ {
+ this.Themes = new List>
+ {
+ new Tuple(nameof(AeroTheme),new AeroTheme()),
+ new Tuple(nameof(ExpressionDarkTheme),new ExpressionDarkTheme()),
+ new Tuple(nameof(ExpressionLightTheme),new ExpressionLightTheme()),
+ new Tuple(nameof(MetroTheme),new MetroTheme()),
+ new Tuple(nameof(VS2010Theme),new VS2010Theme()),
+ new Tuple(nameof(Vs2013BlueTheme),new Vs2013BlueTheme()),
+ new Tuple(nameof(Vs2013DarkTheme),new Vs2013DarkTheme()),
+ new Tuple(nameof(Vs2013LightTheme),new Vs2013LightTheme()),
+ };
+ this.SelectedTheme = Themes.First();
+ }
+ #endregion constructors
+
+ public event EventHandler ActiveDocumentChanged;
+
+ #region properties
+ public static Workspace This => _this;
+
+ public ReadOnlyObservableCollection Files
+ {
+ get
+ {
+ if (_readonyFiles == null)
+ _readonyFiles = new ReadOnlyObservableCollection(_files);
+
+ return _readonyFiles;
+ }
+ }
+
+ public IEnumerable Tools
+ {
+ get
+ {
+ if (_tools == null)
+ _tools = new ToolViewModel[] { FileStats };
+ return _tools;
+ }
+ }
+
+ public FileStatsViewModel FileStats
+ {
+ get
+ {
+ if (_fileStats == null)
+ _fileStats = new FileStatsViewModel();
+
+ return _fileStats;
+ }
+ }
+
+ public ICommand OpenCommand
+ {
+ get
+ {
+ if (_openCommand == null)
+ {
+ _openCommand = new RelayCommand((p) => OnOpen(p), (p) => CanOpen(p));
+ }
+
+ return _openCommand;
+ }
+ }
+
+ public ICommand NewCommand
+ {
+ get
+ {
+ if (_newCommand == null)
+ {
+ _newCommand = new RelayCommand((p) => OnNew(p), (p) => CanNew(p));
+ }
+
+ return _newCommand;
+ }
+ }
+
+ public FileViewModel ActiveDocument
+ {
+ get => _activeDocument;
+ set
+ {
+ if (_activeDocument != value)
+ {
+ _activeDocument = value;
+ RaisePropertyChanged(nameof(ActiveDocument));
+ if (ActiveDocumentChanged != null)
+ ActiveDocumentChanged(this, EventArgs.Empty);
+ }
+ }
+ }
+
+
+ public List> Themes { get; set; }
+
+
+ public Tuple SelectedTheme
+ {
+ get { return selectedTheme; }
+ set
+ {
+ selectedTheme = value;
+ RaisePropertyChanged(nameof(SelectedTheme));
+ }
+ }
+
+ #endregion properties
+
+ #region methods
+ internal void Close(FileViewModel fileToClose)
+ {
+ if (fileToClose.IsDirty)
+ {
+ var res = MessageBox.Show(string.Format("Save changes for file '{0}'?", fileToClose.FileName), "AvalonDock Test App", MessageBoxButton.YesNoCancel);
+ if (res == MessageBoxResult.Cancel)
+ return;
+ if (res == MessageBoxResult.Yes)
+ {
+ Save(fileToClose);
+ }
+ }
+
+ _files.Remove(fileToClose);
+ }
+
+ internal void Save(FileViewModel fileToSave, bool saveAsFlag = false)
+ {
+ if (fileToSave.FilePath == null || saveAsFlag)
+ {
+ var dlg = new SaveFileDialog();
+ if (dlg.ShowDialog().GetValueOrDefault())
+ fileToSave.FilePath = dlg.SafeFileName;
+ }
+ if (fileToSave.FilePath == null)
+ {
+ return;
+ }
+ File.WriteAllText(fileToSave.FilePath, fileToSave.TextContent);
+ ActiveDocument.IsDirty = false;
+ }
+
+ internal FileViewModel Open(string filepath)
+ {
+ var fileViewModel = _files.FirstOrDefault(fm => fm.FilePath == filepath);
+ if (fileViewModel != null)
+ return fileViewModel;
+
+ fileViewModel = new FileViewModel(filepath);
+ _files.Add(fileViewModel);
+ return fileViewModel;
+ }
+
+ #region OpenCommand
+ private bool CanOpen(object parameter) => true;
+
+ private void OnOpen(object parameter)
+ {
+ var dlg = new OpenFileDialog();
+ if (dlg.ShowDialog().GetValueOrDefault())
+ {
+ var fileViewModel = Open(dlg.FileName);
+ ActiveDocument = fileViewModel;
+ }
+ }
+ #endregion OpenCommand
+
+ #region NewCommand
+ private bool CanNew(object parameter)
+ {
+ return true;
+ }
+
+ private void OnNew(object parameter)
+ {
+ _files.Add(new FileViewModel());
+ ActiveDocument = _files.Last();
+ }
+ #endregion
+ #endregion methods
+ }
}
diff --git a/source/TestApp/App.xaml b/source/TestApp/App.xaml
index 1a7b3785..b6cf5818 100644
--- a/source/TestApp/App.xaml
+++ b/source/TestApp/App.xaml
@@ -1,34 +1,32 @@
-
-
-
-
-
+ x:Class="TestApp.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ ShutdownMode="OnMainWindowClose"
+ StartupUri="MainWindow.xaml">
+
+
+
+
+
diff --git a/source/TestApp/MainWindow.xaml b/source/TestApp/MainWindow.xaml
index 59715cf4..6a4da229 100644
--- a/source/TestApp/MainWindow.xaml
+++ b/source/TestApp/MainWindow.xaml
@@ -1,149 +1,153 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ x:Class="TestApp.MainWindow"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:avalonDock="https://github.com/Dirkster99/AvalonDock"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:local="clr-namespace:TestApp"
+ xmlns:winformsIntegration="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
+ Title="MainWindow"
+ Width="525"
+ Height="350"
+ UseLayoutRounding="True">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/TestApp/MainWindow.xaml.cs b/source/TestApp/MainWindow.xaml.cs
index 539136e5..e03df2d2 100644
--- a/source/TestApp/MainWindow.xaml.cs
+++ b/source/TestApp/MainWindow.xaml.cs
@@ -19,6 +19,7 @@ This program is provided to you under the terms of the Microsoft Public
using System.IO;
using AvalonDock.Layout.Serialization;
using AvalonDock;
+using System.Diagnostics.CodeAnalysis;
namespace TestApp
{
@@ -127,7 +128,8 @@ private void OnLayoutRootPropertyChanged(object sender, System.ComponentModel.Pr
}
}
- private void OnLoadLayout(object sender, RoutedEventArgs e)
+ [SuppressMessage("Style", "IDE0063:使用简单的 \"using\" 语句", Justification = "<挂起>")]
+ private void OnLoadLayout(object sender, RoutedEventArgs e)
{
var currentContentsList = dockManager.Layout.Descendents().OfType().Where(c => c.ContentId != null).ToArray();
@@ -143,6 +145,7 @@ private void OnLoadLayout(object sender, RoutedEventArgs e)
serializer.Deserialize(stream);
}
+ [SuppressMessage("Style", "IDE0063:使用简单的 \"using\" 语句", Justification = "<挂起>")]
private void OnSaveLayout(object sender, RoutedEventArgs e)
{
string fileName = (sender as MenuItem).Header.ToString();
@@ -167,13 +170,17 @@ private void AddTwoDocuments_click(object sender, RoutedEventArgs e)
var firstDocumentPane = dockManager.Layout.Descendents().OfType().FirstOrDefault();
if (firstDocumentPane != null)
{
- LayoutDocument doc = new LayoutDocument();
- doc.Title = "Test1";
- firstDocumentPane.Children.Add(doc);
-
- LayoutDocument doc2 = new LayoutDocument();
- doc2.Title = "Test2";
- firstDocumentPane.Children.Add(doc2);
+ LayoutDocument doc = new LayoutDocument
+ {
+ Title = "Test1"
+ };
+ firstDocumentPane.Children.Add(doc);
+
+ LayoutDocument doc2 = new LayoutDocument
+ {
+ Title = "Test2"
+ };
+ firstDocumentPane.Children.Add(doc2);
}
var leftAnchorGroup = dockManager.Layout.LeftSide.Children.FirstOrDefault();
@@ -198,7 +205,7 @@ private void OnShowToolWindow1(object sender, RoutedEventArgs e)
toolWindow1.AddToLayout(dockManager, AnchorableShowStrategy.Bottom | AnchorableShowStrategy.Most);
}
- private void dockManager_DocumentClosing(object sender, DocumentClosingEventArgs e)
+ private void DockManager_DocumentClosing(object sender, DocumentClosingEventArgs e)
{
if (MessageBox.Show("Are you sure you want to close the document?", "AvalonDock Sample", MessageBoxButton.YesNo) == MessageBoxResult.No)
e.Cancel = true;
diff --git a/source/TestApp/TestApp.csproj b/source/TestApp/TestApp.csproj
index 264aeebc..0e2e2511 100644
--- a/source/TestApp/TestApp.csproj
+++ b/source/TestApp/TestApp.csproj
@@ -14,6 +14,8 @@
+
+
diff --git a/source/TestApp/UserControl1.Designer.cs b/source/TestApp/UserControl1.Designer.cs
index 119ce3c7..ba40fca6 100644
--- a/source/TestApp/UserControl1.Designer.cs
+++ b/source/TestApp/UserControl1.Designer.cs
@@ -7,6 +7,8 @@ This program is provided to you under the terms of the Microsoft Public
License (Ms-PL) as published at https://opensource.org/licenses/MS-PL
************************************************************************/
+using System.Drawing;
+
namespace TestApp
{
partial class UserControl1
@@ -65,6 +67,7 @@ private void InitializeComponent()
this.label1.Size = new System.Drawing.Size(52, 13);
this.label1.TabIndex = 1;
this.label1.Text = "TextBox1";
+ this.label1.ForeColor = Color.White;
//
// label2
//
@@ -74,6 +77,7 @@ private void InitializeComponent()
this.label2.Size = new System.Drawing.Size(52, 13);
this.label2.TabIndex = 1;
this.label2.Text = "TextBox2";
+ this.label2.ForeColor = Color.White;
//
// UserControl1
//
@@ -84,6 +88,7 @@ private void InitializeComponent()
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Name = "UserControl1";
+ this.BackColor = Color.Black;
this.ResumeLayout(false);
this.PerformLayout();