diff --git a/README.md b/README.md
index aeeee73f..54ad73f9 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,10 @@ Step 4:enjoy coding
## Latest examples
+### HoneycombPanel
+
+
+
### RunningBlock

@@ -81,12 +85,12 @@ Step 4:enjoy coding

+## History publication
+
### ButtonGroup

-## History publication
-
### Grid

diff --git a/Resources/HoneycombPanel.png b/Resources/HoneycombPanel.png
new file mode 100644
index 00000000..b1fb329a
Binary files /dev/null and b/Resources/HoneycombPanel.png differ
diff --git a/doc/source/handycontrol/native_controls/dataGrid/index.md b/doc/source/handycontrol/native_controls/dataGrid/index.md
index 7ea36f18..093d0e09 100644
--- a/doc/source/handycontrol/native_controls/dataGrid/index.md
+++ b/doc/source/handycontrol/native_controls/dataGrid/index.md
@@ -2,6 +2,19 @@
title: DataGrid 数据表格
---
+# 相关样式
+
+| style名称 | 所属类型 | 用途描述 |
+| - | - | - |
+| RowHeaderGripperStyle | Thumb | 行标题拖拽条样式 |
+| ColumnHeaderGripperStyle | Thumb | 列标题拖拽条样式 |
+| DataGridCellStyle | DataGridCell | 单元格样式 |
+| DataGridRowStyle | DataGridRow | 行样式 |
+| DataGridColumnHeaderStyle | DataGridColumnHeader | 列标题样式 |
+| DataGridRowHeaderStyle | DataGridRowHeader | 行标题样式 |
+| TextBlockComboBoxStyle | ComboBox | ComboBox非编辑模式样式 |
+| DataGridTextColumnStyle | TextBlock | 默认文本样式 |
+
{% note info no-icon %}
用例:
@@ -29,4 +42,35 @@ title: DataGrid 数据表格
{% endcode %}

-{% endnote %}
\ No newline at end of file
+{% endnote %}
+
+# FAQ
+{% note warning no-icon%}
+对于文本显示列`DataGridTextColumn`需要设定文本内容`水平居中`或者`水平居右`,而不是HandyControl中设定的样式默认显示为`居左`时,需要继承`DataGridCellStyle`重写`HorizontalContentAlignment` 属性为`Center` 或`Right` 需要注意的是,此方式仅仅适用于引入了HandControl资源样式的项目,普通原生DataGrid使用该方式无效。
+
+{% endnote %}
+
+用例如下:
+
+{% code %}
+
+样式:
+
+
+
+xaml中的使用:
+
+
+
+
+
+
+
+
+{% endcode %}
+
+效果如下:
+
+
diff --git a/doc/source/handycontrol/native_controls/images/DataGrid-Warning01.png b/doc/source/handycontrol/native_controls/images/DataGrid-Warning01.png
new file mode 100644
index 00000000..f1d39abe
Binary files /dev/null and b/doc/source/handycontrol/native_controls/images/DataGrid-Warning01.png differ
diff --git a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
index b5293883..efb97896 100644
--- a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
+++ b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
@@ -396,6 +396,12 @@
Resources\Img\LeftMainContent\Dynamic_16x.png
+
+ Resources\Img\LeftMainContent\PolygonHexagon_16x.png
+
+
+ Resources\Img\LeftMainContent\HandyControl.png
+
Resources\Img\Dance.png
diff --git a/src/Core_30/HandyControl_Core_30/Themes/Styles/DataGrid.xaml b/src/Core_30/HandyControl_Core_30/Themes/Styles/DataGrid.xaml
index 3593fe3d..0381d657 100644
--- a/src/Core_30/HandyControl_Core_30/Themes/Styles/DataGrid.xaml
+++ b/src/Core_30/HandyControl_Core_30/Themes/Styles/DataGrid.xaml
@@ -257,6 +257,7 @@
+
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 0b10fbd3..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,12 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\HandyControl.png
+
+
+ Resources\Img\LeftMainContent\PolygonHexagon_16x.png
+
Resources\Img\LeftMainContent\Dynamic_16x.png
diff --git a/src/Net_40/HandyControl_Net_40/Themes/Styles/DataGrid.xaml b/src/Net_40/HandyControl_Net_40/Themes/Styles/DataGrid.xaml
index 3f4bf166..a93c8b55 100644
--- a/src/Net_40/HandyControl_Net_40/Themes/Styles/DataGrid.xaml
+++ b/src/Net_40/HandyControl_Net_40/Themes/Styles/DataGrid.xaml
@@ -258,6 +258,7 @@
+
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 251e2bd5..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,12 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\HandyControl.png
+
+
+ Resources\Img\LeftMainContent\PolygonHexagon_16x.png
+
Resources\Img\LeftMainContent\Dynamic_16x.png
diff --git a/src/Net_GE45/HandyControl_Net_GE45/Themes/Styles/DataGrid.xaml b/src/Net_GE45/HandyControl_Net_GE45/Themes/Styles/DataGrid.xaml
index c3c5a29c..41eecff7 100644
--- a/src/Net_GE45/HandyControl_Net_GE45/Themes/Styles/DataGrid.xaml
+++ b/src/Net_GE45/HandyControl_Net_GE45/Themes/Styles/DataGrid.xaml
@@ -257,6 +257,7 @@
+
diff --git a/src/Shared/HandyControlDemo_Shared/App.xaml.cs b/src/Shared/HandyControlDemo_Shared/App.xaml.cs
index c2f58f68..1392706a 100644
--- a/src/Shared/HandyControlDemo_Shared/App.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/App.xaml.cs
@@ -9,9 +9,6 @@ using HandyControlDemo.Tools;
namespace HandyControlDemo
{
- ///
- /// App.xaml 的交互逻辑
- ///
public partial class App
{
protected override void OnStartup(StartupEventArgs e)
diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
index ff297a66..1e09db7a 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
@@ -108,6 +108,10 @@
public static readonly string RunningBlockDemoCtl = nameof(RunningBlockDemoCtl);
+ 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 20805e83..5562e803 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
@@ -56,7 +56,9 @@ var controlList = new List
"CardDemoCtl",
"MagnifierDemoCtl",
"ImageBlockDemoCtl",
- "RunningBlockDemoCtl"
+ "RunningBlockDemoCtl",
+ "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 65f17be3..984abb9a 100644
--- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
+++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
@@ -54,6 +54,9 @@
CardDemoCtl.xaml
+
+ HoneycombPanelDemoCtl.xaml
+
ImageBlockDemoCtl.xaml
@@ -174,6 +177,9 @@
SideMenuDemoCtl.xaml
+
+ SpriteDemoCtl.xaml
+
StepBarDemoCtl.xaml
@@ -322,6 +328,7 @@
+
@@ -333,6 +340,9 @@
AboutWindow.xaml
+
+ AppSprite.xaml
+
BlurWindow.xaml
@@ -429,6 +439,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -589,6 +603,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -773,6 +791,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControlDemo_Shared/MainWindow.xaml b/src/Shared/HandyControlDemo_Shared/MainWindow.xaml
index e82bc22b..9ff31060 100644
--- a/src/Shared/HandyControlDemo_Shared/MainWindow.xaml
+++ b/src/Shared/HandyControlDemo_Shared/MainWindow.xaml
@@ -12,9 +12,10 @@
ShowTitle="False"
ResizeMode="CanResizeWithGrip"
WindowStartupLocation="CenterScreen"
- hc:GlobalShortcut.Host="True"
DataContext="{Binding Main,Source={StaticResource Locator}}"
+ hc:GlobalShortcut.Host="True"
hc:Dialog.Token="{x:Static data:MessageToken.MainWindow}"
+ hc:WindowAttach.IgnoreAltF4="True"
d:DesignHeight="800"
d:DesignWidth="1400"
Icon="/HandyControlDemo;component/Resources/Img/icon.ico">
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
index c5abda38..43270cfc 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
@@ -69,6 +69,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 添加项 的本地化字符串。
+ ///
+ public static string AddItem {
+ get {
+ return ResourceManager.GetString("AddItem", resourceCulture);
+ }
+ }
+
///
/// 查找类似 动画路径 的本地化字符串。
///
@@ -672,6 +681,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 蜂窝布局 的本地化字符串。
+ ///
+ public static string HoneycombPanel {
+ get {
+ return ResourceManager.GetString("HoneycombPanel", resourceCulture);
+ }
+ }
+
///
/// 查找类似 混合布局 的本地化字符串。
///
@@ -969,6 +987,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 打开精灵 的本地化字符串。
+ ///
+ public static string OpenSprite {
+ get {
+ return ResourceManager.GetString("OpenSprite", resourceCulture);
+ }
+ }
+
///
/// 查找类似 轮廓文本 的本地化字符串。
///
@@ -1185,6 +1212,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 删除项 的本地化字符串。
+ ///
+ public static string RemoveItem {
+ get {
+ return ResourceManager.GetString("RemoveItem", resourceCulture);
+ }
+ }
+
///
/// 查找类似 重复按钮 的本地化字符串。
///
@@ -1338,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 8156f572..3efb365c 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
@@ -636,4 +636,19 @@
RunningBlock
+
+ HoneycombPanel
+
+
+ Add an item
+
+
+ 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 6515453f..6b168ea6 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
@@ -636,4 +636,19 @@
滚动块
+
+ 蜂窝布局
+
+
+ 添加项
+
+
+ 删除项
+
+
+ 精灵
+
+
+ 打开精灵
+
\ 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/Img/LeftMainContent/PolygonHexagon_16x.png b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/PolygonHexagon_16x.png
new file mode 100644
index 00000000..0aae4fee
Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/PolygonHexagon_16x.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/Service/Data/DataService.cs b/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs
index cd558e1d..0ea49299 100644
--- a/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs
+++ b/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs
@@ -157,9 +157,9 @@ namespace HandyControlDemo.Service
};
}
- internal List GetCardDataList()
+ internal ObservableCollection GetCardDataList()
{
- return new List
+ return new ObservableCollection
{
new CardModel
{
@@ -224,6 +224,14 @@ namespace HandyControlDemo.Service
};
}
+ internal CardModel GetCardData()
+ {
+ return new CardModel
+ {
+ Content = $"/HandyControlDemo;component/Resources/Img/Album/{DateTime.Now.Second % 10 + 1}.jpg"
+ };
+ }
+
internal List GetStepBarDemoDataList()
{
return new List
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GrowlDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GrowlDemoCtl.xaml.cs
index cbf99957..c3474865 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GrowlDemoCtl.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GrowlDemoCtl.xaml.cs
@@ -1,9 +1,6 @@
namespace HandyControlDemo.UserControl
{
- ///
- /// GrowlDemoGrid.xaml 的交互逻辑
- ///
public partial class GrowlDemoCtl
{
public GrowlDemoCtl()
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/HoneycombPanelDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/HoneycombPanelDemoCtl.xaml
new file mode 100644
index 00000000..9d1f7c91
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/HoneycombPanelDemoCtl.xaml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/HoneycombPanelDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/HoneycombPanelDemoCtl.xaml.cs
new file mode 100644
index 00000000..13c4d23e
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/HoneycombPanelDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class HoneycombPanelDemoCtl
+ {
+ public HoneycombPanelDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ImageBrowserDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ImageBrowserDemoCtl.xaml.cs
index d40e1b88..da51a2c1 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ImageBrowserDemoCtl.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ImageBrowserDemoCtl.xaml.cs
@@ -1,9 +1,6 @@
namespace HandyControlDemo.UserControl
{
- ///
- /// ImageBrowserDemoCtl.xaml 的交互逻辑
- ///
public partial class ImageBrowserDemoCtl
{
public ImageBrowserDemoCtl()
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/Controls/StepBarDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/StepBarDemoCtl.xaml.cs
index cadb827f..991bab9b 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/StepBarDemoCtl.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/StepBarDemoCtl.xaml.cs
@@ -1,9 +1,6 @@
namespace HandyControlDemo.UserControl
{
- ///
- /// StepBarDemoCtl.xaml 的交互逻辑
- ///
public partial class StepBarDemoCtl
{
public StepBarDemoCtl()
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 68a0e2a9..9f3b9c51 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
@@ -220,7 +220,7 @@
-
+
@@ -330,7 +330,7 @@
-
+
@@ -350,6 +350,11 @@
+
+
+
+
+
@@ -440,6 +445,11 @@
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ExpanderDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ExpanderDemoCtl.xaml.cs
index 31cb303c..6987f5c9 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ExpanderDemoCtl.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ExpanderDemoCtl.xaml.cs
@@ -2,9 +2,6 @@
namespace HandyControlDemo.UserControl
{
- ///
- /// ExpanderDemoCtl.xaml 的交互逻辑
- ///
public partial class ExpanderDemoCtl
{
public ExpanderDemoCtl()
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/TextBlockDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/TextBlockDemoCtl.xaml.cs
index fc1ac558..faea8b77 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/TextBlockDemoCtl.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/TextBlockDemoCtl.xaml.cs
@@ -1,9 +1,6 @@
namespace HandyControlDemo.UserControl
{
- ///
- /// TextBlockDemoCtl.xaml 的交互逻辑
- ///
public partial class TextBlockDemoCtl
{
public TextBlockDemoCtl()
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToggleButtonDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToggleButtonDemoCtl.xaml.cs
index f4889ca3..9f5240df 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToggleButtonDemoCtl.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToggleButtonDemoCtl.xaml.cs
@@ -1,9 +1,6 @@
namespace HandyControlDemo.UserControl
{
- ///
- /// ToggleButtonDemoCtl.xaml 的交互逻辑
- ///
public partial class ToggleButtonDemoCtl
{
public ToggleButtonDemoCtl()
diff --git a/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/CardDemoViewModel.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/CardDemoViewModel.cs
index 10ddfb36..671d2c52 100644
--- a/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/CardDemoViewModel.cs
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/CardDemoViewModel.cs
@@ -1,13 +1,34 @@
-using HandyControlDemo.Data;
+using System;
+#if netle40
+using GalaSoft.MvvmLight.Command;
+#else
+using GalaSoft.MvvmLight.CommandWpf;
+#endif
+using HandyControlDemo.Data;
using HandyControlDemo.Service;
namespace HandyControlDemo.ViewModel
{
public class CardDemoViewModel : DemoViewModelBase
{
+ private readonly DataService _dataService;
+
public CardDemoViewModel(DataService dataService)
{
+ _dataService = dataService;
DataList = dataService.GetCardDataList();
}
+
+ public RelayCommand AddItemCmd => new Lazy(() =>
+ new RelayCommand(() => DataList.Insert(0, _dataService.GetCardData()))).Value;
+
+ public RelayCommand RemoveItemCmd => new Lazy(() =>
+ new RelayCommand(() =>
+ {
+ if (DataList.Count > 0)
+ {
+ DataList.RemoveAt(0);
+ }
+ })).Value;
}
}
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/Main/MainViewModel.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/Main/MainViewModel.cs
index 5b3c1691..939d32e2 100644
--- a/src/Shared/HandyControlDemo_Shared/ViewModel/Main/MainViewModel.cs
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/Main/MainViewModel.cs
@@ -16,7 +16,7 @@ namespace HandyControlDemo.ViewModel
{
public class MainViewModel : DemoViewModelBase
{
-#region 字段
+ #region 字段
///
/// 内容标题
@@ -33,7 +33,7 @@ namespace HandyControlDemo.ViewModel
///
private ListBoxItem _listBoxItemCurrent;
-#endregion
+ #endregion
public MainViewModel(DataService dataService)
{
@@ -54,7 +54,7 @@ namespace HandyControlDemo.ViewModel
DataList = dataService.GetDemoDataList();
}
-#region 属性
+ #region 属性
///
/// 子内容
@@ -84,7 +84,7 @@ namespace HandyControlDemo.ViewModel
#endregion
-#region 命令
+ #region 命令
///
/// 切换例子命令
diff --git a/src/Shared/HandyControlDemo_Shared/ViewModel/ViewModelLocator.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/ViewModelLocator.cs
index 9c5b6759..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(() =>
@@ -88,7 +89,9 @@ namespace HandyControlDemo.ViewModel
public NoUserViewModel NoUser => ServiceLocator.Current.GetInstance();
- public CardDemoViewModel CardDemo => ServiceLocator.Current.GetInstance();
+ public CardDemoViewModel CardDemo => new CardDemoViewModel(ServiceLocator.Current.GetInstance());
+
+ public SpriteDemoViewModel SpriteDemo => ServiceLocator.Current.GetInstance();
#endregion
}
diff --git a/src/Shared/HandyControl_Shared/Controls/Attach/DataGridAttach.cs b/src/Shared/HandyControl_Shared/Controls/Attach/DataGridAttach.cs
index 12a0e725..ec004f40 100644
--- a/src/Shared/HandyControl_Shared/Controls/Attach/DataGridAttach.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Attach/DataGridAttach.cs
@@ -8,6 +8,44 @@ namespace HandyControl.Controls
{
public class DataGridAttach
{
+ public static readonly DependencyProperty ApplyDefaultStyleProperty = DependencyProperty.RegisterAttached(
+ "ApplyDefaultStyle", typeof(bool), typeof(DataGridAttach), new PropertyMetadata(ValueBoxes.FalseBox, OnApplyDefaultStyleChanged));
+
+ private static void OnApplyDefaultStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var grid = (DataGrid)d;
+ if ((bool)e.NewValue)
+ {
+ if (grid.AutoGenerateColumns)
+ {
+ grid.AutoGeneratedColumns += Grid_AutoGeneratedColumns;
+ return;
+ }
+
+ UpdateTextColumnStyles(grid);
+ UpdateComboBoxColumnStyles(grid);
+ UpdateCheckBoxColumnStyles(grid);
+ }
+ else
+ {
+ grid.AutoGeneratedColumns -= Grid_AutoGeneratedColumns;
+ }
+ }
+
+ private static void Grid_AutoGeneratedColumns(object sender, System.EventArgs e)
+ {
+ var grid = (DataGrid)sender;
+ UpdateTextColumnStyles(grid);
+ UpdateComboBoxColumnStyles(grid);
+ UpdateCheckBoxColumnStyles(grid);
+ }
+
+ public static void SetApplyDefaultStyle(DependencyObject element, bool value)
+ => element.SetValue(ApplyDefaultStyleProperty, value);
+
+ public static bool GetApplyDefaultStyle(DependencyObject element)
+ => (bool) element.GetValue(ApplyDefaultStyleProperty);
+
public static readonly DependencyProperty TextColumnStyleProperty = DependencyProperty.RegisterAttached(
"TextColumnStyle", typeof(Style), typeof(DataGridAttach), new PropertyMetadata(default(Style), OnTextColumnStyleChanged));
diff --git a/src/Shared/HandyControl_Shared/Controls/Attach/WindowAttach.cs b/src/Shared/HandyControl_Shared/Controls/Attach/WindowAttach.cs
index 99909ec9..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
{
@@ -37,5 +40,72 @@ namespace HandyControl.Controls
System.Windows.Window.GetWindow(obj)?.DragMove();
}
}
+
+ public static readonly DependencyProperty IgnoreAltF4Property = DependencyProperty.RegisterAttached(
+ "IgnoreAltF4", typeof(bool), typeof(WindowAttach), new PropertyMetadata(ValueBoxes.FalseBox, OnIgnoreAltF4Changed));
+
+ private static void OnIgnoreAltF4Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is System.Windows.Window window)
+ {
+ if ((bool)e.NewValue)
+ {
+ window.PreviewKeyDown += Window_PreviewKeyDown;
+ }
+ else
+ {
+ window.PreviewKeyDown -= Window_PreviewKeyDown;
+ }
+ }
+ }
+
+ private static void Window_PreviewKeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.System && e.SystemKey == Key.F4)
+ {
+ e.Handled = true;
+ }
+ }
+
+ public static void SetIgnoreAltF4(DependencyObject element, bool value)
+ => element.SetValue(IgnoreAltF4Property, value);
+
+ 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/Input/NumericUpDown.cs b/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs
index 5f8f3f48..761fa2d9 100644
--- a/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs
@@ -65,7 +65,8 @@ namespace HandyControl.Controls
{
if (_textBox != null)
{
- _textBox.TextChanged -= TextBox_TextChanged;
+ TextCompositionManager.RemovePreviewTextInputHandler(_textBox, PreviewTextInputHandler);
+ _textBox.TextChanged -= _textBox_TextChanged;
_textBox.PreviewKeyDown -= TextBox_PreviewKeyDown;
_textBox.LostFocus -= TextBox_LostFocus;
}
@@ -76,13 +77,27 @@ namespace HandyControl.Controls
if (_textBox != null)
{
- _textBox.TextChanged += TextBox_TextChanged;
+ TextCompositionManager.AddPreviewTextInputHandler(_textBox, PreviewTextInputHandler);
+ _textBox.TextChanged += _textBox_TextChanged;
_textBox.PreviewKeyDown += TextBox_PreviewKeyDown;
_textBox.LostFocus += TextBox_LostFocus;
_textBox.Text = CurrentText;
}
}
+ private void _textBox_TextChanged(object sender, TextChangedEventArgs e) => UpdateData();
+
+ private void UpdateData()
+ {
+ if (!VerifyData()) return;
+ if (double.TryParse(_textBox.Text, out var value))
+ {
+ Value = value;
+ }
+ }
+
+ private void PreviewTextInputHandler(object sender, TextCompositionEventArgs e) => UpdateData();
+
private void TextBox_LostFocus(object sender, RoutedEventArgs e)
{
if (IsError) return;
@@ -103,15 +118,6 @@ namespace HandyControl.Controls
}
}
- private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
- {
- if (!VerifyData()) return;
- if (double.TryParse(_textBox.Text, out var value))
- {
- Value = value;
- }
- }
-
protected override void OnMouseWheel(MouseWheelEventArgs e)
{
base.OnMouseWheel(e);
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..0d1bea88
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Other/Sprite.cs
@@ -0,0 +1,64 @@
+using System.Windows;
+using System.Windows.Input;
+
+namespace HandyControl.Controls
+{
+ public sealed class Sprite : System.Windows.Window
+ {
+ private bool _isLeftButtonPressed;
+
+ private double _leftMax;
+
+ private double _topMax;
+
+ private Sprite()
+ {
+ WindowStyle = WindowStyle.None;
+ AllowsTransparency = true;
+ InputManager.Current.PostProcessInput += Current_PostProcessInput;
+ }
+
+ private void Current_PostProcessInput(object sender, ProcessInputEventArgs e)
+ {
+ if (Mouse.LeftButton == MouseButtonState.Pressed)
+ {
+ _isLeftButtonPressed = true;
+ }
+ else if(_isLeftButtonPressed)
+ {
+ if (Left < 0)
+ {
+ Left = 0;
+ }
+
+ if (Left > _leftMax)
+ {
+ Left = _leftMax;
+ }
+
+ if (Top > _topMax)
+ {
+ Top = _topMax;
+ }
+ }
+ }
+
+ public static Sprite Show(object content)
+ {
+ var sprite = new Sprite
+ {
+ Content = content
+ };
+
+ sprite.Show();
+
+ var desktopWorkingArea = SystemParameters.WorkArea;
+ sprite._leftMax = desktopWorkingArea.Width - sprite.ActualWidth;
+ sprite._topMax = desktopWorkingArea.Height - sprite.ActualHeight;
+ sprite.Left = sprite._leftMax - 50;
+ sprite.Top = 50 - sprite.Padding.Top;
+
+ return sprite;
+ }
+ }
+}
\ 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
new file mode 100644
index 00000000..1b3c3045
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Panel/HoneycombPanel.cs
@@ -0,0 +1,166 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace HandyControl.Controls
+{
+ public class HoneycombPanel : Panel
+ {
+ private double _unitLength;
+
+ private HoneycombStuffer _stuffer;
+
+ private static int GetXCount(int count)
+ {
+ if (count == 0) return 0;
+
+ count -= 1;
+
+ var index = (int) Math.Floor(Math.Pow((12.0 * count + 25) / 36, 0.5) - 5.0 / 6);
+ var valeIndex = 3 * index * index + 5 * index;
+ var centerValue = valeIndex + 2;
+
+ return count >= centerValue
+ ? 4 * index + 6
+ : count > valeIndex
+ ? 4 * index + 4
+ : 4 * index + 2;
+ }
+
+ private static int GetYCount(int count)
+ {
+ if (count == 0) return 0;
+
+ count -= 1;
+
+ var index = (int)Math.Floor(Math.Pow(count / 3.0 + 0.25, 0.5) - 0.5);
+ var valeIndex = 3 * index * index + 3 * index;
+
+ return count > valeIndex
+ ? 2 * index + 2
+ : 2 * index;
+ }
+
+ /*
+ * layout order
+ *
+ * ● ●
+ * (7) (8)
+ *
+ * ● ● ●
+ * (6) (1) (9)
+ *
+ * ● ● ● ...
+ * (5) (0) (2)
+ *
+ * ● ● ...
+ * (4) (3)
+ *
+ */
+ protected override Size MeasureOverride(Size availableSize)
+ {
+ var maxSize = new Size();
+
+ foreach (UIElement child in InternalChildren)
+ {
+ if (child != null)
+ {
+ child.Measure(availableSize);
+ maxSize.Width = Math.Max(maxSize.Width, child.DesiredSize.Width);
+ maxSize.Height = Math.Max(maxSize.Height, child.DesiredSize.Height);
+ }
+ }
+
+ _unitLength = Math.Max(maxSize.Width, maxSize.Height) / 2;
+
+ var xCount = GetXCount(InternalChildren.Count);
+ var yCount = GetYCount(InternalChildren.Count);
+
+ var availableWidth = xCount * _unitLength;
+ var availableHeight = yCount * Math.Pow(3, 0.5) * _unitLength + _unitLength * 2;
+
+ return new Size(availableWidth, availableHeight);
+ }
+
+ protected override Size ArrangeOverride(Size finalSize)
+ {
+ var childLength = _unitLength * 2;
+ _stuffer = new HoneycombStuffer(new Rect(finalSize.Width / 2 - _unitLength,
+ finalSize.Height / 2 - _unitLength, childLength, childLength));
+
+ foreach (UIElement child in InternalChildren)
+ {
+ child.Arrange(_stuffer.Move());
+ }
+
+ return finalSize;
+ }
+
+ private class HoneycombStuffer
+ {
+ private int _turns;
+
+ private int _maxIndex;
+
+ private int _currentIndex = -1;
+
+ private readonly double _offsetX;
+
+ private readonly double _offsetY;
+
+ private Rect _childBounds;
+
+ private readonly double[] _offsetXArr;
+
+ private readonly double[] _offsetYArr;
+
+ public HoneycombStuffer(Rect childBounds)
+ {
+ _childBounds = childBounds;
+ _offsetX = childBounds.Width / 2;
+ _offsetY = Math.Pow(3, 0.5) * _offsetX;
+
+ _offsetXArr = new[]
+ {
+ 2 * _offsetX,
+ _offsetX,
+ -_offsetX,
+ -2 * _offsetX,
+ -_offsetX,
+ _offsetX
+ };
+
+ _offsetYArr = new[]
+ {
+ 0,
+ _offsetY,
+ _offsetY,
+ 0,
+ -_offsetY,
+ -_offsetY
+ };
+ }
+
+ public Rect Move()
+ {
+ _currentIndex++;
+ if (_currentIndex > _maxIndex)
+ {
+ _turns++;
+ _maxIndex = _turns * 6 - 1;
+ _currentIndex = 0;
+ _childBounds.Offset(_offsetX, -_offsetY);
+ return _childBounds;
+ }
+
+ if (_turns > 0)
+ {
+ var index = _currentIndex / _turns;
+ _childBounds.Offset(_offsetXArr[index], _offsetYArr[index]);
+ }
+
+ return _childBounds;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
index c83ace32..09c934eb 100644
--- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
+++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
@@ -24,11 +24,14 @@
+
+
+
@@ -761,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/Border.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Border.xaml
index 8a47202a..5bafc2a9 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Border.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Border.xaml
@@ -4,10 +4,12 @@
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
index 2685a52c..a7ccfe6f 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
@@ -71,6 +71,7 @@
+
\ No newline at end of file