diff --git a/.gitignore b/.gitignore index 88942805..50bd5274 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,9 @@ /.vs /packages -/HandyControl/bin/Debug -/HandyControl/obj/Debug -/HandyControl/bin/Release -/HandyControl/obj/Release -/HandyControlDemo/bin/Debug -/HandyControlDemo/obj/Debug -/HandyControlDemo/bin/Release -/HandyControlDemo/obj/Release +/HandyControl/bin +/HandyControl/obj +/HandyControlDemo/bin +/HandyControlDemo/obj +/DockContainerResearch/bin +/DockContainerResearch/obj /HandyControl.sln.DotSettings.user \ No newline at end of file diff --git a/DockContainerResearch/App.xaml b/DockContainerResearch/App.xaml new file mode 100644 index 00000000..ea3bd154 --- /dev/null +++ b/DockContainerResearch/App.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/DockContainerResearch/App.xaml.cs b/DockContainerResearch/App.xaml.cs new file mode 100644 index 00000000..a26371c1 --- /dev/null +++ b/DockContainerResearch/App.xaml.cs @@ -0,0 +1,6 @@ +namespace DockBoxResearch +{ + public partial class App + { + } +} diff --git a/DockContainerResearch/Controls/DocDockBoxItem.cs b/DockContainerResearch/Controls/DocDockBoxItem.cs new file mode 100644 index 00000000..aa7afa37 --- /dev/null +++ b/DockContainerResearch/Controls/DocDockBoxItem.cs @@ -0,0 +1,7 @@ +namespace DockBoxResearch.Controls +{ + public class DocDockBoxItem : DockBoxItemBase + { + + } +} \ No newline at end of file diff --git a/DockContainerResearch/Controls/DocDockBoxItemPanel.cs b/DockContainerResearch/Controls/DocDockBoxItemPanel.cs new file mode 100644 index 00000000..fb48479c --- /dev/null +++ b/DockContainerResearch/Controls/DocDockBoxItemPanel.cs @@ -0,0 +1,9 @@ +using System.Windows.Controls; + +namespace DockBoxResearch.Controls +{ + public class DocDockBoxItemPanel : Panel + { + + } +} \ No newline at end of file diff --git a/DockContainerResearch/Controls/DockBox.cs b/DockContainerResearch/Controls/DockBox.cs new file mode 100644 index 00000000..38fd4ab8 --- /dev/null +++ b/DockContainerResearch/Controls/DockBox.cs @@ -0,0 +1,9 @@ +using System.Windows.Controls; + +namespace DockBoxResearch.Controls +{ + public class DockBox : Control + { + + } +} \ No newline at end of file diff --git a/DockContainerResearch/Controls/DockBoxItem.cs b/DockContainerResearch/Controls/DockBoxItem.cs new file mode 100644 index 00000000..489ad3a4 --- /dev/null +++ b/DockContainerResearch/Controls/DockBoxItem.cs @@ -0,0 +1,7 @@ +namespace DockBoxResearch.Controls +{ + public class DockBoxItem : DockBoxItemBase + { + + } +} \ No newline at end of file diff --git a/DockContainerResearch/Controls/DockBoxItemBase.cs b/DockContainerResearch/Controls/DockBoxItemBase.cs new file mode 100644 index 00000000..6ec22fcb --- /dev/null +++ b/DockContainerResearch/Controls/DockBoxItemBase.cs @@ -0,0 +1,9 @@ +using System.Windows.Controls; + +namespace DockBoxResearch.Controls +{ + public class DockBoxItemBase : Control + { + + } +} \ No newline at end of file diff --git a/DockContainerResearch/Controls/DockBoxItemPanel.cs b/DockContainerResearch/Controls/DockBoxItemPanel.cs new file mode 100644 index 00000000..db34c077 --- /dev/null +++ b/DockContainerResearch/Controls/DockBoxItemPanel.cs @@ -0,0 +1,9 @@ +using System.Windows.Controls; + +namespace DockBoxResearch.Controls +{ + public class DockBoxItemPanel : Panel + { + + } +} \ No newline at end of file diff --git a/DockContainerResearch/DockBoxResearch.csproj b/DockContainerResearch/DockBoxResearch.csproj new file mode 100644 index 00000000..3f665051 --- /dev/null +++ b/DockContainerResearch/DockBoxResearch.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {8A444D0A-E3DD-446F-95C4-0A132179D20F} + WinExe + DockBoxResearch + DockBoxResearch + v4.6.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + + + + + + MainWindow.xaml + Code + + + Designer + MSBuild:Compile + + + + + Code + + + + + {dc966e3d-bcff-4652-98cf-070e5494749a} + HandyControl + + + + + + + \ No newline at end of file diff --git a/DockContainerResearch/MainWindow.xaml b/DockContainerResearch/MainWindow.xaml new file mode 100644 index 00000000..e9779428 --- /dev/null +++ b/DockContainerResearch/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/DockContainerResearch/MainWindow.xaml.cs b/DockContainerResearch/MainWindow.xaml.cs new file mode 100644 index 00000000..b66ade7f --- /dev/null +++ b/DockContainerResearch/MainWindow.xaml.cs @@ -0,0 +1,10 @@ +namespace DockBoxResearch +{ + public partial class MainWindow + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/DockContainerResearch/Properties/AssemblyInfo.cs b/DockContainerResearch/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..4d04696a --- /dev/null +++ b/DockContainerResearch/Properties/AssemblyInfo.cs @@ -0,0 +1,16 @@ +using System.Reflection; +using System.Runtime.InteropServices; +using System.Windows; + +[assembly: AssemblyTitle("DockContainerResearch")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DockContainerResearch")] +[assembly: AssemblyCopyright("Copyright © NaBian 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] +[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DockContainerResearch/Resources/Themes/Basic/Geometries.xaml b/DockContainerResearch/Resources/Themes/Basic/Geometries.xaml new file mode 100644 index 00000000..1ca0c753 --- /dev/null +++ b/DockContainerResearch/Resources/Themes/Basic/Geometries.xaml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/HandyControl.sln b/HandyControl.sln index 94d5900f..913f5780 100644 --- a/HandyControl.sln +++ b/HandyControl.sln @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HandyControl", "HandyContro EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HandyControlDemo", "HandyControlDemo\HandyControlDemo.csproj", "{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DockBoxResearch", "DockContainerResearch\DockBoxResearch.csproj", "{8A444D0A-E3DD-446F-95C4-0A132179D20F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug|Any CPU.Build.0 = Debug|Any CPU {9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release|Any CPU.ActiveCfg = Release|Any CPU {9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release|Any CPU.Build.0 = Release|Any CPU + {8A444D0A-E3DD-446F-95C4-0A132179D20F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A444D0A-E3DD-446F-95C4-0A132179D20F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A444D0A-E3DD-446F-95C4-0A132179D20F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A444D0A-E3DD-446F-95C4-0A132179D20F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/HandyControl/Controls/ISingleOpen.cs b/HandyControl/Controls/ISingleOpen.cs new file mode 100644 index 00000000..d6b688f8 --- /dev/null +++ b/HandyControl/Controls/ISingleOpen.cs @@ -0,0 +1,9 @@ +using System; + +namespace HandyControl.Controls +{ + public interface ISingleOpen : IDisposable + { + bool CanDispose { get; } + } +} \ No newline at end of file diff --git a/HandyControl/Controls/Picker/ColorPicker.cs b/HandyControl/Controls/Picker/ColorPicker.cs index a7d9fb47..87448489 100644 --- a/HandyControl/Controls/Picker/ColorPicker.cs +++ b/HandyControl/Controls/Picker/ColorPicker.cs @@ -22,7 +22,7 @@ namespace HandyControl.Controls [TemplatePart(Name = ElementSliderColor, Type = typeof(Panel))] [TemplatePart(Name = ElementSliderOpacity, Type = typeof(Panel))] [TemplatePart(Name = ElementPanelRgb, Type = typeof(Panel))] - public class ColorPicker : Control + public class ColorPicker : Control, ISingleOpen { #region Constants @@ -669,5 +669,9 @@ namespace HandyControl.Controls }); private void ButtonCancel_OnClick(object sender, RoutedEventArgs e) => RaiseEvent(new RoutedEventArgs(CanceledEvent)); + + public void Dispose() => Window.GetWindow(this)?.Close(); + + public bool CanDispose { get; } = true; } } \ No newline at end of file diff --git a/HandyControl/Controls/Window/PopupWindow.cs b/HandyControl/Controls/Window/PopupWindow.cs index 7270b443..6f4c60ec 100644 --- a/HandyControl/Controls/Window/PopupWindow.cs +++ b/HandyControl/Controls/Window/PopupWindow.cs @@ -28,6 +28,10 @@ namespace HandyControl.Controls private TextBlock _titleBlock; + private bool _showBackground = true; + + private FrameworkElement _targetElement; + public override void OnApplyTemplate() { if (_titleBlock != null) @@ -44,6 +48,11 @@ namespace HandyControl.Controls { _titleBlock.MouseLeftButtonDown += TitleBlock_OnMouseLeftButtonDown; } + + if (PopupElement != null) + { + _mainBorder.Child = PopupElement; + } } internal static readonly DependencyProperty ContentStrProperty = DependencyProperty.Register( @@ -68,6 +77,16 @@ namespace HandyControl.Controls if (!IsDialog) Owner?.Focus(); }; + Loaded += (s, e) => + { + if (!_showBackground) + { + var point = ArithmeticHelper.CalSafePoint(_targetElement, PopupElement, BorderThickness); + Left = point.X; + Top = point.Y; + Opacity = 1; + } + }; try { Owner = Application.Current.MainWindow; @@ -82,17 +101,7 @@ namespace HandyControl.Controls private void CloseButton_OnClick(object sender, RoutedEventArgs e) => Close(); - public UIElement Child - { - get => _mainBorder?.Child; - set - { - if (_mainBorder != null) - { - _mainBorder.Child = value; - } - } - } + public FrameworkElement PopupElement { get; set; } public static readonly DependencyProperty ShowTitleProperty = DependencyProperty.Register( "ShowTitle", typeof(bool), typeof(PopupWindow), new PropertyMetadata(true)); @@ -129,19 +138,37 @@ namespace HandyControl.Controls } } - public void Show(FrameworkElement element) + public void Show(FrameworkElement element, bool showBackground = true) { - var point = ArithmeticHelper.CalSafePoint(element, Child as FrameworkElement); - Left = point.X; - Top = point.Y; + if (!showBackground) + { + Opacity = 0; + AllowsTransparency = true; + WindowStyle = WindowStyle.None; + ShowTitle = false; + MinWidth = 0; + MinHeight = 0; + } + + _showBackground = showBackground; + _targetElement = element; Show(); } - public void ShowDialog(FrameworkElement element) + public void ShowDialog(FrameworkElement element, bool showBackground = true) { - var point = ArithmeticHelper.CalSafePoint(element, Child as FrameworkElement); - Left = point.X; - Top = point.Y; + if (!showBackground) + { + Opacity = 0; + AllowsTransparency = true; + WindowStyle = WindowStyle.None; + ShowTitle = false; + MinWidth = 0; + MinHeight = 0; + } + + _showBackground = showBackground; + _targetElement = element; ShowDialog(); } @@ -159,7 +186,7 @@ namespace HandyControl.Controls AllowsTransparency = true, WindowStyle = WindowStyle.None, ContentStr = message, - WindowStartupLocation = WindowStartupLocation.CenterScreen, + WindowStartupLocation = WindowStartupLocation.CenterScreen }; window.Background = window.FindResource("PrimaryBrush") as SolidColorBrush; window.Show(); @@ -202,7 +229,7 @@ namespace HandyControl.Controls protected override void OnClosed(EventArgs e) { base.OnClosed(e); - Child = null; + PopupElement = null; } } } \ No newline at end of file diff --git a/HandyControl/Controls/Window/WindowBorderless.cs b/HandyControl/Controls/Window/WindowBorderless.cs index be776be3..b1f63dbf 100644 --- a/HandyControl/Controls/Window/WindowBorderless.cs +++ b/HandyControl/Controls/Window/WindowBorderless.cs @@ -16,8 +16,8 @@ namespace HandyControl.Controls { private Thickness _tempThickness; - public static readonly DependencyProperty NoUserContentProperty = DependencyProperty.Register( - "NoUserContent", typeof(object), typeof(WindowBorderless), new PropertyMetadata(default(object))); + public static readonly DependencyProperty NonClientAreaContentProperty = DependencyProperty.Register( + "NonClientAreaContent", typeof(object), typeof(WindowBorderless), new PropertyMetadata(default(object))); public static readonly DependencyProperty CloseButtonHoverBrushProperty = DependencyProperty.Register( "CloseButtonHoverBrush", typeof(Brush), typeof(WindowBorderless), @@ -45,20 +45,20 @@ namespace HandyControl.Controls "OtherButtonHoverForeground", typeof(Brush), typeof(WindowBorderless), new PropertyMetadata(default(Brush))); - public static readonly DependencyProperty NoUserAreaBackgroundProperty = DependencyProperty.Register( - "NoUserAreaBackground", typeof(Brush), typeof(WindowBorderless), + public static readonly DependencyProperty NonClientAreaBackgroundProperty = DependencyProperty.Register( + "NonClientAreaBackground", typeof(Brush), typeof(WindowBorderless), new PropertyMetadata(default(Brush))); - public static readonly DependencyProperty NoUserAreaForegroundProperty = DependencyProperty.Register( - "NoUserAreaForeground", typeof(Brush), typeof(WindowBorderless), + public static readonly DependencyProperty NonClientAreaForegroundProperty = DependencyProperty.Register( + "NonClientAreaForeground", typeof(Brush), typeof(WindowBorderless), new PropertyMetadata(default(Brush))); - public static readonly DependencyProperty NoUserAreaHeightProperty = DependencyProperty.Register( - "NoUserAreaHeight", typeof(double), typeof(WindowBorderless), + public static readonly DependencyProperty NonClientAreaHeightProperty = DependencyProperty.Register( + "NonClientAreaHeight", typeof(double), typeof(WindowBorderless), new PropertyMetadata(28.0)); - public static readonly DependencyProperty ShowNoUserAreaProperty = DependencyProperty.Register( - "ShowNoUserArea", typeof(bool), typeof(WindowBorderless), new PropertyMetadata(true)); + public static readonly DependencyProperty ShowNonClientAreaProperty = DependencyProperty.Register( + "ShowNonClientArea", typeof(bool), typeof(WindowBorderless), new PropertyMetadata(true)); public static readonly DependencyProperty ShowTitleProperty = DependencyProperty.Register( "ShowTitle", typeof(bool), typeof(WindowBorderless), new PropertyMetadata(default(bool))); @@ -96,7 +96,7 @@ namespace HandyControl.Controls GlassFrameThickness = new Thickness(1) }; BindingOperations.SetBinding(chrome, WindowChrome.CaptionHeightProperty, - new Binding(NoUserAreaHeightProperty.Name) {Source = this}); + new Binding(NonClientAreaHeightProperty.Name) {Source = this}); WindowChrome.SetWindowChrome(this, chrome); Loaded += delegate @@ -169,10 +169,10 @@ namespace HandyControl.Controls /// private ResizeMode OriginResizeMode { get; set; } - public double NoUserAreaHeight + public double NonClientAreaHeight { - get => (double)GetValue(NoUserAreaHeightProperty); - set => SetValue(NoUserAreaHeightProperty, value); + get => (double)GetValue(NonClientAreaHeightProperty); + set => SetValue(NonClientAreaHeightProperty, value); } public bool IsFullScreen @@ -181,10 +181,10 @@ namespace HandyControl.Controls set => SetValue(IsFullScreenProperty, value); } - public object NoUserContent + public object NonClientAreaContent { - get => GetValue(NoUserContentProperty); - set => SetValue(NoUserContentProperty, value); + get => GetValue(NonClientAreaContentProperty); + set => SetValue(NonClientAreaContentProperty, value); } public Brush CloseButtonHoverBrush @@ -211,22 +211,22 @@ namespace HandyControl.Controls set => SetValue(OtherButtonHoverForegroundProperty, value); } - public Brush NoUserAreaBackground + public Brush NonClientAreaBackground { - get => (Brush)GetValue(NoUserAreaBackgroundProperty); - set => SetValue(NoUserAreaBackgroundProperty, value); + get => (Brush)GetValue(NonClientAreaBackgroundProperty); + set => SetValue(NonClientAreaBackgroundProperty, value); } - public Brush NoUserAreaForeground + public Brush NonClientAreaForeground { - get => (Brush)GetValue(NoUserAreaForegroundProperty); - set => SetValue(NoUserAreaForegroundProperty, value); + get => (Brush)GetValue(NonClientAreaForegroundProperty); + set => SetValue(NonClientAreaForegroundProperty, value); } - public bool ShowNoUserArea + public bool ShowNonClientArea { - get => (bool)GetValue(ShowNoUserAreaProperty); - set => SetValue(ShowNoUserAreaProperty, value); + get => (bool)GetValue(ShowNonClientAreaProperty); + set => SetValue(ShowNonClientAreaProperty, value); } public bool ShowTitle diff --git a/HandyControl/HandyControl.csproj b/HandyControl/HandyControl.csproj index e7e40b08..e51efb5c 100644 --- a/HandyControl/HandyControl.csproj +++ b/HandyControl/HandyControl.csproj @@ -49,6 +49,7 @@ + @@ -58,6 +59,7 @@ + @@ -194,6 +196,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -342,6 +348,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/HandyControl/Themes/Styles/Base/CheckBoxBaseStyle.xaml b/HandyControl/Themes/Styles/Base/CheckBoxBaseStyle.xaml index 930e59e1..a3b43856 100644 --- a/HandyControl/Themes/Styles/Base/CheckBoxBaseStyle.xaml +++ b/HandyControl/Themes/Styles/Base/CheckBoxBaseStyle.xaml @@ -5,7 +5,7 @@ - + @@ -15,12 +15,12 @@ - + - + diff --git a/HandyControl/Themes/Styles/Base/RadioButtonBaseStyle.xaml b/HandyControl/Themes/Styles/Base/RadioButtonBaseStyle.xaml new file mode 100644 index 00000000..23567c7a --- /dev/null +++ b/HandyControl/Themes/Styles/Base/RadioButtonBaseStyle.xaml @@ -0,0 +1,89 @@ + + + + + \ No newline at end of file diff --git a/HandyControl/Themes/Styles/Base/ScrollViewerBaseStyle.xaml b/HandyControl/Themes/Styles/Base/ScrollViewerBaseStyle.xaml index 6134dd61..f7445a91 100644 --- a/HandyControl/Themes/Styles/Base/ScrollViewerBaseStyle.xaml +++ b/HandyControl/Themes/Styles/Base/ScrollViewerBaseStyle.xaml @@ -145,8 +145,8 @@ - - + + @@ -187,8 +187,8 @@ - - + + diff --git a/HandyControl/Themes/Styles/CheckBox.xaml b/HandyControl/Themes/Styles/CheckBox.xaml index 2e33b6eb..e2c5b915 100644 --- a/HandyControl/Themes/Styles/CheckBox.xaml +++ b/HandyControl/Themes/Styles/CheckBox.xaml @@ -1,10 +1,9 @@ - + - +