diff --git a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
index 0f5b3822..efb97896 100644
--- a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
+++ b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
@@ -399,6 +399,9 @@
Resources\Img\LeftMainContent\PolygonHexagon_16x.png
+
+ Resources\Img\LeftMainContent\HandyControl.png
+
Resources\Img\Dance.png
diff --git a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
index 0af990f9..530c4e9d 100644
--- a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
+++ b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
@@ -417,6 +417,9 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\HandyControl.png
+
Resources\Img\LeftMainContent\PolygonHexagon_16x.png
diff --git a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
index 2987971d..a2e724d7 100644
--- a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
+++ b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
@@ -480,6 +480,9 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\HandyControl.png
+
Resources\Img\LeftMainContent\PolygonHexagon_16x.png
diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
index 1fdfbf4a..1e09db7a 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
@@ -110,6 +110,8 @@
public static readonly string HoneycombPanelDemoCtl = nameof(HoneycombPanelDemoCtl);
+ public static readonly string SpriteDemoCtl = nameof(SpriteDemoCtl);
+
public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl);
public static readonly string RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl);
diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
index efb23e47..5562e803 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
@@ -57,7 +57,8 @@ var controlList = new List
"MagnifierDemoCtl",
"ImageBlockDemoCtl",
"RunningBlockDemoCtl",
- "HoneycombPanelDemoCtl"
+ "HoneycombPanelDemoCtl",
+ "SpriteDemoCtl"
};
var styleList = new List
{
diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
index 3b28efa9..984abb9a 100644
--- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
+++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
@@ -177,6 +177,9 @@
SideMenuDemoCtl.xaml
+
+ SpriteDemoCtl.xaml
+
StepBarDemoCtl.xaml
@@ -325,6 +328,7 @@
+
@@ -336,6 +340,9 @@
AboutWindow.xaml
+
+ AppSprite.xaml
+
BlurWindow.xaml
@@ -596,6 +603,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -780,6 +791,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
index 910885a1..43270cfc 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
@@ -987,6 +987,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 打开精灵 的本地化字符串。
+ ///
+ public static string OpenSprite {
+ get {
+ return ResourceManager.GetString("OpenSprite", resourceCulture);
+ }
+ }
+
///
/// 查找类似 轮廓文本 的本地化字符串。
///
@@ -1365,6 +1374,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 精灵 的本地化字符串。
+ ///
+ public static string Sprite {
+ get {
+ return ResourceManager.GetString("Sprite", resourceCulture);
+ }
+ }
+
///
/// 查找类似 步骤 的本地化字符串。
///
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
index 92647771..3efb365c 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
@@ -645,4 +645,10 @@
Remove an item
+
+ Sprite
+
+
+ Open sprite
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
index c034998d..6b168ea6 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
@@ -645,4 +645,10 @@
删除项
+
+ 精灵
+
+
+ 打开精灵
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/HandyControl.png b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/HandyControl.png
new file mode 100644
index 00000000..911df219
Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/HandyControl.png differ
diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Themes/Styles/Style.xaml b/src/Shared/HandyControlDemo_Shared/Resources/Themes/Styles/Style.xaml
index 8bcccf6a..49a0d290 100644
--- a/src/Shared/HandyControlDemo_Shared/Resources/Themes/Styles/Style.xaml
+++ b/src/Shared/HandyControlDemo_Shared/Resources/Themes/Styles/Style.xaml
@@ -94,4 +94,8 @@
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml
new file mode 100644
index 00000000..282b15b0
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml.cs
new file mode 100644
index 00000000..fa59e94e
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class SpriteDemoCtl
+ {
+ public SpriteDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml
new file mode 100644
index 00000000..4f135524
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml.cs
new file mode 100644
index 00000000..b0cba5f3
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class AppSprite
+ {
+ public AppSprite()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
index b94ff6ec..9f3b9c51 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
@@ -330,7 +330,7 @@
-
+
@@ -445,6 +445,11 @@
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/SpriteDemoViewModel.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/SpriteDemoViewModel.cs
new file mode 100644
index 00000000..46d154ab
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/SpriteDemoViewModel.cs
@@ -0,0 +1,18 @@
+using System;
+using GalaSoft.MvvmLight;
+using HandyControl.Controls;
+using HandyControlDemo.UserControl;
+#if netle40
+using GalaSoft.MvvmLight.Command;
+#else
+using GalaSoft.MvvmLight.CommandWpf;
+# endif
+
+namespace HandyControlDemo
+{
+ public class SpriteDemoViewModel : ViewModelBase
+ {
+ public RelayCommand OpenCmd => new Lazy(() =>
+ new RelayCommand(()=> Sprite.Show(new AppSprite()))).Value;
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/ViewModel/ViewModelLocator.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/ViewModelLocator.cs
index 94eeca7a..a623d046 100644
--- a/src/Shared/HandyControlDemo_Shared/ViewModel/ViewModelLocator.cs
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/ViewModelLocator.cs
@@ -39,6 +39,7 @@ namespace HandyControlDemo.ViewModel
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
+ SimpleIoc.Default.Register();
}
public static ViewModelLocator Instance => new Lazy(() =>
@@ -90,6 +91,8 @@ namespace HandyControlDemo.ViewModel
public CardDemoViewModel CardDemo => new CardDemoViewModel(ServiceLocator.Current.GetInstance());
+ public SpriteDemoViewModel SpriteDemo => ServiceLocator.Current.GetInstance();
+
#endregion
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Attach/WindowAttach.cs b/src/Shared/HandyControl_Shared/Controls/Attach/WindowAttach.cs
index fb600659..911f6fec 100644
--- a/src/Shared/HandyControl_Shared/Controls/Attach/WindowAttach.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Attach/WindowAttach.cs
@@ -1,6 +1,9 @@
-using System.Windows;
+using System;
+using System.Windows;
using System.Windows.Input;
+using System.Windows.Interop;
using HandyControl.Data;
+using HandyControl.Tools.Interop;
namespace HandyControl.Controls
{
@@ -21,7 +24,7 @@ namespace HandyControl.Controls
{
if ((bool)e.NewValue)
{
- ctl.MouseLeftButtonDown += DragElement_MouseLeftButtonDown; ;
+ ctl.MouseLeftButtonDown += DragElement_MouseLeftButtonDown;
}
else
{
@@ -69,5 +72,40 @@ namespace HandyControl.Controls
public static bool GetIgnoreAltF4(DependencyObject element)
=> (bool) element.GetValue(IgnoreAltF4Property);
+
+ public static readonly DependencyProperty ShowInTaskManagerProperty = DependencyProperty.RegisterAttached(
+ "ShowInTaskManager", typeof(bool), typeof(WindowAttach), new PropertyMetadata(ValueBoxes.TrueBox, OnShowInTaskManagerChanged));
+
+ private static void OnShowInTaskManagerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is System.Windows.Window window)
+ {
+ if ((bool)e.NewValue)
+ {
+ window.SourceInitialized -= Window_SourceInitialized;
+ }
+ else
+ {
+ window.SourceInitialized += Window_SourceInitialized;
+ }
+ }
+ }
+
+ private static void Window_SourceInitialized(object sender, EventArgs e)
+ {
+ if (sender is System.Windows.Window window)
+ {
+ var _ = new WindowInteropHelper(window)
+ {
+ Owner = NativeMethods.GetDesktopWindow()
+ };
+ }
+ }
+
+ public static void SetShowInTaskManager(DependencyObject element, bool value)
+ => element.SetValue(ShowInTaskManagerProperty, value);
+
+ public static bool GetShowInTaskManager(DependencyObject element)
+ => (bool) element.GetValue(ShowInTaskManagerProperty);
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs b/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs
index a341abbc..38c75cd5 100644
--- a/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs
@@ -1,8 +1,5 @@
-using System;
-using System.Windows;
+using System.Windows;
using System.Windows.Controls;
-using System.Windows.Interop;
-using HandyControl.Tools.Interop;
namespace HandyControl.Controls
{
@@ -26,16 +23,6 @@ namespace HandyControl.Controls
GrowlPanel = GetTemplateChild(ElementGrowPanel) as Panel;
}
- protected override void OnSourceInitialized(EventArgs e)
- {
- base.OnSourceInitialized(e);
-
- var _ = new WindowInteropHelper(this)
- {
- Owner = NativeMethods.GetDesktopWindow()
- };
- }
-
public void Init()
{
var desktopWorkingArea = SystemParameters.WorkArea;
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/Sprite.cs b/src/Shared/HandyControl_Shared/Controls/Other/Sprite.cs
new file mode 100644
index 00000000..fb7340e5
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Other/Sprite.cs
@@ -0,0 +1,7 @@
+namespace HandyControl.Controls
+{
+ public class Sprite : System.Windows.Window
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Panel/CirclePanel.cs b/src/Shared/HandyControl_Shared/Controls/Panel/CirclePanel.cs
index 1eebdf43..1ad31640 100644
--- a/src/Shared/HandyControl_Shared/Controls/Panel/CirclePanel.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Panel/CirclePanel.cs
@@ -35,18 +35,28 @@ namespace HandyControl.Controls
set => SetValue(OffsetAngleProperty, value);
}
- // ReSharper disable once RedundantAssignment
protected override Size MeasureOverride(Size availableSize)
{
if (Children.Count == 0) return new Size(Diameter, Diameter);
- availableSize = new Size(Diameter, Diameter);
+ var newSize = new Size(Diameter, Diameter);
+
+ foreach (UIElement element in Children)
+ {
+ element.Measure(newSize);
+ }
+
+ return newSize;
+ }
+
+ protected override Size ArrangeOverride(Size finalSize)
+ {
var i = 0;
var perDeg = 360.0 / Children.Count;
var radius = Diameter / 2;
+
foreach (UIElement element in Children)
{
- element.Measure(availableSize);
var centerX = element.DesiredSize.Width / 2.0;
var centerY = element.DesiredSize.Height / 2.0;
var angle = perDeg * i++ + OffsetAngle;
@@ -60,11 +70,12 @@ namespace HandyControl.Controls
var r = Math.PI * angle / 180.0;
var x = radius * Math.Cos(r);
var y = radius * Math.Sin(r);
- var rectX = x + availableSize.Width / 2 - centerX;
- var rectY = y + availableSize.Height / 2 - centerY;
+ var rectX = x + finalSize.Width / 2 - centerX;
+ var rectY = y + finalSize.Height / 2 - centerY;
element.Arrange(new Rect(rectX, rectY, element.DesiredSize.Width, element.DesiredSize.Height));
}
- return availableSize;
+
+ return finalSize;
}
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Panel/HoneycombPanel.cs b/src/Shared/HandyControl_Shared/Controls/Panel/HoneycombPanel.cs
index 91982f7d..1b3c3045 100644
--- a/src/Shared/HandyControl_Shared/Controls/Panel/HoneycombPanel.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Panel/HoneycombPanel.cs
@@ -93,7 +93,7 @@ namespace HandyControl.Controls
child.Arrange(_stuffer.Move());
}
- return base.ArrangeOverride(finalSize);
+ return finalSize;
}
private class HoneycombStuffer
diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
index a974057f..09c934eb 100644
--- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
+++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
@@ -24,12 +24,14 @@
+
+
@@ -762,6 +764,10 @@
Designer
MSBuild:Compile
+
+ MSBuild:Compile
+ Designer
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControl_Shared/Interactivity/Commands/CloseWindowCommand.cs b/src/Shared/HandyControl_Shared/Interactivity/Commands/CloseWindowCommand.cs
new file mode 100644
index 00000000..392abeab
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Interactivity/Commands/CloseWindowCommand.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Windows;
+using System.Windows.Input;
+
+namespace HandyControl.Interactivity
+{
+ public class CloseWindowCommand : ICommand
+ {
+ public bool CanExecute(object parameter) => true;
+
+ public void Execute(object parameter)
+ {
+ if (parameter is DependencyObject dependencyObject)
+ {
+ if (Window.GetWindow(dependencyObject) is Window window)
+ {
+ window.Close();
+ }
+ }
+ }
+
+ public event EventHandler CanExecuteChanged;
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Interactivity/Commands/ControlCommands.cs b/src/Shared/HandyControl_Shared/Interactivity/Commands/ControlCommands.cs
index ab66b196..07c58353 100644
--- a/src/Shared/HandyControl_Shared/Interactivity/Commands/ControlCommands.cs
+++ b/src/Shared/HandyControl_Shared/Interactivity/Commands/ControlCommands.cs
@@ -156,5 +156,10 @@ namespace HandyControl.Interactivity
/// 前置主窗口
///
public static PushMainWindow2TopCommand PushMainWindow2Top { get; } = new PushMainWindow2TopCommand();
+
+ ///
+ /// 关闭窗口
+ ///
+ public static CloseWindowCommand CloseWindow { get; } = new CloseWindowCommand();
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml
index 9fd38d69..f54f7525 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml
@@ -11,6 +11,8 @@