diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 00000000..bbb5cda6
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: # Replace with a single Patreon username
+open_collective: handycontrol # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index d5b0367d..150c58a4 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -1,6 +1,9 @@
---
name: Bug report
about: Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
---
diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md
new file mode 100644
index 00000000..48d5f81f
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/custom.md
@@ -0,0 +1,10 @@
+---
+name: Custom issue template
+about: Describe this issue template's purpose here.
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 00000000..bbcbbe7d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/.gitignore b/.gitignore
index d51beecc..73a9dc99 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,9 @@
*.user
*.xml
[Bb]in/
-[Oo]bj/
\ No newline at end of file
+[Oo]bj/
+packages/
+build/*
+!build/build.cake
+!build/build.nuspec
+!build/build.ps1
\ No newline at end of file
diff --git a/DockBoxResearch/App.xaml b/DockBoxResearch/App.xaml
deleted file mode 100644
index ea3bd154..00000000
--- a/DockBoxResearch/App.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
diff --git a/DockBoxResearch/Controls/DocDockBoxItem.cs b/DockBoxResearch/Controls/DocDockBoxItem.cs
deleted file mode 100644
index aa7afa37..00000000
--- a/DockBoxResearch/Controls/DocDockBoxItem.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace DockBoxResearch.Controls
-{
- public class DocDockBoxItem : DockBoxItemBase
- {
-
- }
-}
\ No newline at end of file
diff --git a/DockBoxResearch/Controls/DocDockBoxItemPanel.cs b/DockBoxResearch/Controls/DocDockBoxItemPanel.cs
deleted file mode 100644
index fb48479c..00000000
--- a/DockBoxResearch/Controls/DocDockBoxItemPanel.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System.Windows.Controls;
-
-namespace DockBoxResearch.Controls
-{
- public class DocDockBoxItemPanel : Panel
- {
-
- }
-}
\ No newline at end of file
diff --git a/DockBoxResearch/Controls/DockBox.cs b/DockBoxResearch/Controls/DockBox.cs
deleted file mode 100644
index 38fd4ab8..00000000
--- a/DockBoxResearch/Controls/DockBox.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System.Windows.Controls;
-
-namespace DockBoxResearch.Controls
-{
- public class DockBox : Control
- {
-
- }
-}
\ No newline at end of file
diff --git a/DockBoxResearch/Controls/DockBoxItem.cs b/DockBoxResearch/Controls/DockBoxItem.cs
deleted file mode 100644
index 489ad3a4..00000000
--- a/DockBoxResearch/Controls/DockBoxItem.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace DockBoxResearch.Controls
-{
- public class DockBoxItem : DockBoxItemBase
- {
-
- }
-}
\ No newline at end of file
diff --git a/DockBoxResearch/Controls/DockBoxItemBase.cs b/DockBoxResearch/Controls/DockBoxItemBase.cs
deleted file mode 100644
index 6ec22fcb..00000000
--- a/DockBoxResearch/Controls/DockBoxItemBase.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System.Windows.Controls;
-
-namespace DockBoxResearch.Controls
-{
- public class DockBoxItemBase : Control
- {
-
- }
-}
\ No newline at end of file
diff --git a/DockBoxResearch/Controls/DockBoxItemPanel.cs b/DockBoxResearch/Controls/DockBoxItemPanel.cs
deleted file mode 100644
index db34c077..00000000
--- a/DockBoxResearch/Controls/DockBoxItemPanel.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System.Windows.Controls;
-
-namespace DockBoxResearch.Controls
-{
- public class DockBoxItemPanel : Panel
- {
-
- }
-}
\ No newline at end of file
diff --git a/DockBoxResearch/MainWindow.xaml b/DockBoxResearch/MainWindow.xaml
deleted file mode 100644
index e9779428..00000000
--- a/DockBoxResearch/MainWindow.xaml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
diff --git a/Installers/VS2019/HandyControl_VS2019.sln b/Installers/VS2019/HandyControl_VS2019.sln
index 6e2908e9..2c1629ff 100644
--- a/Installers/VS2019/HandyControl_VS2019.sln
+++ b/Installers/VS2019/HandyControl_VS2019.sln
@@ -5,6 +5,10 @@ VisualStudioVersion = 16.0.28803.352
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HandyControl_VS2019", "HandyControl_VS2019\HandyControl_VS2019.csproj", "{3F0F7B9E-C150-4FAA-9274-4F6F0A96B8CA}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApp", "WpfApp\WpfApp.csproj", "{83C70EB1-3A3F-4812-B86C-C7D1936699EB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfCoreApp", "WpfCoreApp\WpfCoreApp.csproj", "{2F6E9FB8-F579-40CF-A151-57F281F08E1B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +19,14 @@ Global
{3F0F7B9E-C150-4FAA-9274-4F6F0A96B8CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3F0F7B9E-C150-4FAA-9274-4F6F0A96B8CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3F0F7B9E-C150-4FAA-9274-4F6F0A96B8CA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {83C70EB1-3A3F-4812-B86C-C7D1936699EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {83C70EB1-3A3F-4812-B86C-C7D1936699EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {83C70EB1-3A3F-4812-B86C-C7D1936699EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {83C70EB1-3A3F-4812-B86C-C7D1936699EB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2F6E9FB8-F579-40CF-A151-57F281F08E1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2F6E9FB8-F579-40CF-A151-57F281F08E1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2F6E9FB8-F579-40CF-A151-57F281F08E1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2F6E9FB8-F579-40CF-A151-57F281F08E1B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Installers/VS2019/HandyControl_VS2019/HandyControl_VS2019.csproj b/Installers/VS2019/HandyControl_VS2019/HandyControl_VS2019.csproj
index a652ad34..ba720bad 100644
--- a/Installers/VS2019/HandyControl_VS2019/HandyControl_VS2019.csproj
+++ b/Installers/VS2019/HandyControl_VS2019/HandyControl_VS2019.csproj
@@ -49,18 +49,6 @@
-
- Always
- true
-
-
- Always
- true
-
-
- Always
- true
-
Designer
@@ -86,7 +74,22 @@
Always
-
+
+
+ {83C70EB1-3A3F-4812-B86C-C7D1936699EB}
+ WpfApp
+ ProjectTemplates
+ false
+ TemplateProjectOutputGroup%3b
+
+
+ {2F6E9FB8-F579-40CF-A151-57F281F08E1B}
+ WpfCoreApp
+ ProjectTemplates
+ false
+ TemplateProjectOutputGroup%3b
+
+
+
\ No newline at end of file
diff --git a/Installers/VS2019/WpfCoreApp/WpfCoreApp.vstemplate b/Installers/VS2019/WpfCoreApp/WpfCoreApp.vstemplate
new file mode 100644
index 00000000..532eaeaf
--- /dev/null
+++ b/Installers/VS2019/WpfCoreApp/WpfCoreApp.vstemplate
@@ -0,0 +1,27 @@
+
+
+
+ HandyControl WPF App(.NET Core)
+ Creates a HandyControl WPF App(.NET Core)
+ icon.ico
+ CSharp
+ true
+ HandyControlProject
+ true
+ csharp
+ windows
+ desktop
+ HandyControl
+ Enabled
+ true
+ true
+
+
+
+ App.xaml
+ App.xaml.cs
+ MainWindow.xaml
+ MainWindow.xaml.cs
+
+
+
\ No newline at end of file
diff --git a/Installers/VS2019/WpfCoreApp/icon.ico b/Installers/VS2019/WpfCoreApp/icon.ico
new file mode 100644
index 00000000..719edf88
Binary files /dev/null and b/Installers/VS2019/WpfCoreApp/icon.ico differ
diff --git a/LICENSE b/LICENSE
index f9f0dead..3d3d568c 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2018-2019 HandyOrg
+Copyright (c) 2018-2020 HandyOrg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 5c454e93..2faaf251 100644
--- a/README.md
+++ b/README.md
@@ -1,31 +1,66 @@
-
+
-   [](https://www.nuget.org/packages/HandyControl) [](https://ci.appveyor.com/project/handyorg/handycontrol) [](https://gitter.im/HandyControl/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](//shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1)
-[](https://github.com/ghost1372/HandyControl/wiki) 
+   [](https://www.nuget.org/packages/HandyControl) [](https://ci.appveyor.com/project/handyorg/handycontrol) [](https://gitter.im/HandyControl/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://github.com/ghost1372/HandyControl/wiki) [](https://www.nuget.org/packages/HandyControl)
# Welcome to HandyControl
-## We're all here
-
-
-
## 面向中国
-### 中文文档(刚开始写)
+### 加入讨论
+
+| | 1群 (已满) | 2群 |
+|-|:-:|:-:|
+| 群号码 | [](//shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1) | [](//shang.qq.com/wpa/qunwpa?idkey=5c18622a0f6ee07a6f33afa8cdb85b1f72ea50e878271dfcec919c76b55afee7) |
+| 二维码 |  |  |
+
+### 中文文档
[https://handyorg.github.io/handycontrol/](https://handyorg.github.io/handycontrol/)
-### 捐赠
-如果您觉得HandyControl还不错,并且刚好有些闲钱,那么可以选择以下两种方式来捐赠:
+### 赞助
+如果您觉得HandyControl还不错,并且刚好有些闲钱,那么可以选择以下两种方式来赞助:
* [以HandyControl的名义为慈善事业做贡献](http://www.chinacharityfederation.org/ConfirmDonation/0.html?zhijie=3)
* 为我们购买防脱洗发水
-
+
+
+## Contributors
+
+
+
+
+
+
+
+
+
+
+
+
+## Backers
+
+
+
+
+
+
+
+
+
+
+
+
+
+
## Special thanks to
-[](https://www.jetbrains.com/?from=HandyControl)
+[](https://visualstudio.microsoft.com/free-developer-offers/)
+[](https://www.jetbrains.com/?from=HandyControl)
+[](https://cakebuild.net/)
+[](https://www.appveyor.com/)
+[](https://gitter.im/)
## Usage
@@ -57,310 +92,374 @@ Step 4:enjoy coding
## Overview
-
+
-
+
## Latest examples
-### ImageBlock
+### Screenshot
-
+
-
+### GooeyEffect
-### Magnifier
+
-
+### GlowWindow
-### Card
+
-
+### FlowDocumentScrollViewerStyle
-### ButtonGroup
+
-
+### PinBox
+
+
## History publication
+### Effects
+
+
+
+### RelativePanel
+
+
+
+### Drawer
+
+
+
+### Poptip
+
+
+
+### Divider
+
+
+
+### GeometryAnimation
+
+
+
+### SplitButton
+
+
+
+### FloatingBlock
+
+
+
+### HoneycombPanel
+
+
+
+### RunningBlock
+
+
+
+### ImageBlock
+
+
+
+
+
+### Magnifier
+
+
+
+### Card
+
+
+
+### ButtonGroup
+
+
+
### Grid
-
+
### SideMenu
-
+
### NotifyIcon
-
+
### Dialog
-
+
### WaveProgressBar
-
+
### Badge
-
+
### Gravatar
-
+
### GoToTop
-
+
### ChatBubble
-
+
### Label
-
+
### Transfer
-
+
### ProgressButton
-
+
### CoverFlow
-
+
### CoverView
-
+
### MessageBox
-
+
### WaterfallPanel
-
+
### Rate
-
+
### BlurWindow
-
+
### FlipClock
-
+
### Shield
-
+
### OutlineText
-
+
### Tag
-
+
### ToolBar
-
+
### Slider
-
+
### CircleProgressBar
-
+
### ButtonStyle
-
+
### ToggleButtonStyle
-
+
### RadioButtonStyle
-
+
### CheckBoxStyle
-
+
### ListBoxStyle
-
+
### TreeViewStyle
-
+
### ListViewStyle
-
+
### DataGrid
-
+
### Now you can switch to dark theme
-
+
### ColorPicker
-
+
### Loading
-
+
### Carousel
-
+
### Pagination
-
+
### Expander
-
+
### TimeBar
-
+
### ImageBrowser
-
+
### PreviewSlider
-
+
### CompareSlider
-
+
-
+
### Growl
-
+
### AnimationPath
-
+
### ProgressBar
-
+
### TabControl
-
+
### TabControlStyle
-
+
### GroupBox
-
+
### StepBar
-
+
### GifImage
-
+
### ContextMenu
-
+
### Calendar
-
+
### Clock
-
+
### CalendarWithClock
-
+
### TextBlock
-
+
### RichTextBoxStyle
-
+
### TextBox
-
+
### ComboBox
-
+
### NumericUpDown
-
+
### SearchBar
-
+
### PasswordBox
-
+
### DataPicker
-
+
### TimePicker
-
+
### DateTimePicker
-
+
### ScrollViewer
-
+
### CirclePanel
-
+
+
+### TransitioningContentControl
+
+
### BorderStyle
-
+
### Brush
-
+
## Switching configuration
-
+
diff --git a/Resources/AnimationPath.gif b/Resources/AnimationPath.gif
deleted file mode 100644
index d58704cf..00000000
Binary files a/Resources/AnimationPath.gif and /dev/null differ
diff --git a/Resources/Badge.png b/Resources/Badge.png
deleted file mode 100644
index 2b015d45..00000000
Binary files a/Resources/Badge.png and /dev/null differ
diff --git a/Resources/BlurWindow.png b/Resources/BlurWindow.png
deleted file mode 100644
index 821cd44d..00000000
Binary files a/Resources/BlurWindow.png and /dev/null differ
diff --git a/Resources/Border.png b/Resources/Border.png
deleted file mode 100644
index 847ec85e..00000000
Binary files a/Resources/Border.png and /dev/null differ
diff --git a/Resources/Brush.png b/Resources/Brush.png
deleted file mode 100644
index 2cfb9b6f..00000000
Binary files a/Resources/Brush.png and /dev/null differ
diff --git a/Resources/Button.png b/Resources/Button.png
deleted file mode 100644
index 4c35b08f..00000000
Binary files a/Resources/Button.png and /dev/null differ
diff --git a/Resources/ButtonGroup.png b/Resources/ButtonGroup.png
deleted file mode 100644
index 25041947..00000000
Binary files a/Resources/ButtonGroup.png and /dev/null differ
diff --git a/Resources/Calendar.jpg b/Resources/Calendar.jpg
deleted file mode 100644
index 4f0648aa..00000000
Binary files a/Resources/Calendar.jpg and /dev/null differ
diff --git a/Resources/CalendarWithClock.png b/Resources/CalendarWithClock.png
deleted file mode 100644
index 01f6832f..00000000
Binary files a/Resources/CalendarWithClock.png and /dev/null differ
diff --git a/Resources/Card.png b/Resources/Card.png
deleted file mode 100644
index df4358b2..00000000
Binary files a/Resources/Card.png and /dev/null differ
diff --git a/Resources/Carousel.gif b/Resources/Carousel.gif
deleted file mode 100644
index 00d30c61..00000000
Binary files a/Resources/Carousel.gif and /dev/null differ
diff --git a/Resources/ChatBubble.png b/Resources/ChatBubble.png
deleted file mode 100644
index f65a021f..00000000
Binary files a/Resources/ChatBubble.png and /dev/null differ
diff --git a/Resources/CheckBox.png b/Resources/CheckBox.png
deleted file mode 100644
index eb409317..00000000
Binary files a/Resources/CheckBox.png and /dev/null differ
diff --git a/Resources/CirclePanel.jpg b/Resources/CirclePanel.jpg
deleted file mode 100644
index d8e8a261..00000000
Binary files a/Resources/CirclePanel.jpg and /dev/null differ
diff --git a/Resources/CircleProgressBar.png b/Resources/CircleProgressBar.png
deleted file mode 100644
index 4de90d35..00000000
Binary files a/Resources/CircleProgressBar.png and /dev/null differ
diff --git a/Resources/Clock.jpg b/Resources/Clock.jpg
deleted file mode 100644
index eb8862cf..00000000
Binary files a/Resources/Clock.jpg and /dev/null differ
diff --git a/Resources/ColorPicker.gif b/Resources/ColorPicker.gif
deleted file mode 100644
index 63ef07e5..00000000
Binary files a/Resources/ColorPicker.gif and /dev/null differ
diff --git a/Resources/ComboBox.jpg b/Resources/ComboBox.jpg
deleted file mode 100644
index 3e8b72db..00000000
Binary files a/Resources/ComboBox.jpg and /dev/null differ
diff --git a/Resources/CompareSlider-h.gif b/Resources/CompareSlider-h.gif
deleted file mode 100644
index 9f01e150..00000000
Binary files a/Resources/CompareSlider-h.gif and /dev/null differ
diff --git a/Resources/CompareSlider-v.gif b/Resources/CompareSlider-v.gif
deleted file mode 100644
index 0ac49668..00000000
Binary files a/Resources/CompareSlider-v.gif and /dev/null differ
diff --git a/Resources/ContextMenu.png b/Resources/ContextMenu.png
deleted file mode 100644
index 4afeeb86..00000000
Binary files a/Resources/ContextMenu.png and /dev/null differ
diff --git a/Resources/CoverFlow.gif b/Resources/CoverFlow.gif
deleted file mode 100644
index 68045629..00000000
Binary files a/Resources/CoverFlow.gif and /dev/null differ
diff --git a/Resources/CoverView.gif b/Resources/CoverView.gif
deleted file mode 100644
index bebb0e05..00000000
Binary files a/Resources/CoverView.gif and /dev/null differ
diff --git a/Resources/DarkTheme.png b/Resources/DarkTheme.png
deleted file mode 100644
index b4b04669..00000000
Binary files a/Resources/DarkTheme.png and /dev/null differ
diff --git a/Resources/DataGrid.png b/Resources/DataGrid.png
deleted file mode 100644
index 9f0cc8a0..00000000
Binary files a/Resources/DataGrid.png and /dev/null differ
diff --git a/Resources/DataPicker.jpg b/Resources/DataPicker.jpg
deleted file mode 100644
index 864385a0..00000000
Binary files a/Resources/DataPicker.jpg and /dev/null differ
diff --git a/Resources/DateTimePicker.png b/Resources/DateTimePicker.png
deleted file mode 100644
index 1f46c5c8..00000000
Binary files a/Resources/DateTimePicker.png and /dev/null differ
diff --git a/Resources/Dialog.png b/Resources/Dialog.png
deleted file mode 100644
index 8bfcd737..00000000
Binary files a/Resources/Dialog.png and /dev/null differ
diff --git a/Resources/Expander.gif b/Resources/Expander.gif
deleted file mode 100644
index 8d0266d5..00000000
Binary files a/Resources/Expander.gif and /dev/null differ
diff --git a/Resources/FlipClock.gif b/Resources/FlipClock.gif
deleted file mode 100644
index f685d7e7..00000000
Binary files a/Resources/FlipClock.gif and /dev/null differ
diff --git a/Resources/GifImage.gif b/Resources/GifImage.gif
deleted file mode 100644
index e883a221..00000000
Binary files a/Resources/GifImage.gif and /dev/null differ
diff --git a/Resources/GoToTop.gif b/Resources/GoToTop.gif
deleted file mode 100644
index 85d3ca8a..00000000
Binary files a/Resources/GoToTop.gif and /dev/null differ
diff --git a/Resources/Gravatar.gif b/Resources/Gravatar.gif
deleted file mode 100644
index efb9e671..00000000
Binary files a/Resources/Gravatar.gif and /dev/null differ
diff --git a/Resources/Grid.gif b/Resources/Grid.gif
deleted file mode 100644
index 9041b842..00000000
Binary files a/Resources/Grid.gif and /dev/null differ
diff --git a/Resources/GroupBox.png b/Resources/GroupBox.png
deleted file mode 100644
index aa93b7c4..00000000
Binary files a/Resources/GroupBox.png and /dev/null differ
diff --git a/Resources/Growl.gif b/Resources/Growl.gif
deleted file mode 100644
index 22faeb20..00000000
Binary files a/Resources/Growl.gif and /dev/null differ
diff --git a/Resources/ImageBlock.gif b/Resources/ImageBlock.gif
deleted file mode 100644
index d64e99d5..00000000
Binary files a/Resources/ImageBlock.gif and /dev/null differ
diff --git a/Resources/ImageBlock.png b/Resources/ImageBlock.png
deleted file mode 100644
index 4157f8a2..00000000
Binary files a/Resources/ImageBlock.png and /dev/null differ
diff --git a/Resources/ImageBrowser.gif b/Resources/ImageBrowser.gif
deleted file mode 100644
index 41dbfcca..00000000
Binary files a/Resources/ImageBrowser.gif and /dev/null differ
diff --git a/Resources/Label.png b/Resources/Label.png
deleted file mode 100644
index abd87bf7..00000000
Binary files a/Resources/Label.png and /dev/null differ
diff --git a/Resources/ListBox.png b/Resources/ListBox.png
deleted file mode 100644
index 57645014..00000000
Binary files a/Resources/ListBox.png and /dev/null differ
diff --git a/Resources/ListView.png b/Resources/ListView.png
deleted file mode 100644
index 40926958..00000000
Binary files a/Resources/ListView.png and /dev/null differ
diff --git a/Resources/Loading.gif b/Resources/Loading.gif
deleted file mode 100644
index b3916949..00000000
Binary files a/Resources/Loading.gif and /dev/null differ
diff --git a/Resources/Magnifier.png b/Resources/Magnifier.png
deleted file mode 100644
index 929ae0c9..00000000
Binary files a/Resources/Magnifier.png and /dev/null differ
diff --git a/Resources/MessageBox.png b/Resources/MessageBox.png
deleted file mode 100644
index cf91e8d2..00000000
Binary files a/Resources/MessageBox.png and /dev/null differ
diff --git a/Resources/NotifyIcon.png b/Resources/NotifyIcon.png
deleted file mode 100644
index 1866c00e..00000000
Binary files a/Resources/NotifyIcon.png and /dev/null differ
diff --git a/Resources/NumericUpDown.png b/Resources/NumericUpDown.png
deleted file mode 100644
index bdf740fb..00000000
Binary files a/Resources/NumericUpDown.png and /dev/null differ
diff --git a/Resources/OutlineText.png b/Resources/OutlineText.png
deleted file mode 100644
index 3f5ec7e1..00000000
Binary files a/Resources/OutlineText.png and /dev/null differ
diff --git a/Resources/Overview-dark.png b/Resources/Overview-dark.png
deleted file mode 100644
index ded33060..00000000
Binary files a/Resources/Overview-dark.png and /dev/null differ
diff --git a/Resources/Overview.png b/Resources/Overview.png
deleted file mode 100644
index d0211362..00000000
Binary files a/Resources/Overview.png and /dev/null differ
diff --git a/Resources/Pagination.gif b/Resources/Pagination.gif
deleted file mode 100644
index 130af623..00000000
Binary files a/Resources/Pagination.gif and /dev/null differ
diff --git a/Resources/PasswordBox.jpg b/Resources/PasswordBox.jpg
deleted file mode 100644
index 4c428068..00000000
Binary files a/Resources/PasswordBox.jpg and /dev/null differ
diff --git a/Resources/PreviewSlider.gif b/Resources/PreviewSlider.gif
deleted file mode 100644
index 270876ad..00000000
Binary files a/Resources/PreviewSlider.gif and /dev/null differ
diff --git a/Resources/ProgressBar.gif b/Resources/ProgressBar.gif
deleted file mode 100644
index 7ba12022..00000000
Binary files a/Resources/ProgressBar.gif and /dev/null differ
diff --git a/Resources/ProgressButton.png b/Resources/ProgressButton.png
deleted file mode 100644
index 9af0542d..00000000
Binary files a/Resources/ProgressButton.png and /dev/null differ
diff --git a/Resources/RadioButton.png b/Resources/RadioButton.png
deleted file mode 100644
index 4f1308e5..00000000
Binary files a/Resources/RadioButton.png and /dev/null differ
diff --git a/Resources/Rate.png b/Resources/Rate.png
deleted file mode 100644
index 1a1f87ca..00000000
Binary files a/Resources/Rate.png and /dev/null differ
diff --git a/Resources/RichTextBox.png b/Resources/RichTextBox.png
deleted file mode 100644
index 2c5245d4..00000000
Binary files a/Resources/RichTextBox.png and /dev/null differ
diff --git a/Resources/ScrollViewer.png b/Resources/ScrollViewer.png
deleted file mode 100644
index 5070ff31..00000000
Binary files a/Resources/ScrollViewer.png and /dev/null differ
diff --git a/Resources/SearchBar.png b/Resources/SearchBar.png
deleted file mode 100644
index fe90bd4d..00000000
Binary files a/Resources/SearchBar.png and /dev/null differ
diff --git a/Resources/Shield.png b/Resources/Shield.png
deleted file mode 100644
index 9d77a7eb..00000000
Binary files a/Resources/Shield.png and /dev/null differ
diff --git a/Resources/SideMenu.png b/Resources/SideMenu.png
deleted file mode 100644
index fc0a655a..00000000
Binary files a/Resources/SideMenu.png and /dev/null differ
diff --git a/Resources/Slider.png b/Resources/Slider.png
deleted file mode 100644
index 9386eb92..00000000
Binary files a/Resources/Slider.png and /dev/null differ
diff --git a/Resources/StepBar.png b/Resources/StepBar.png
deleted file mode 100644
index d32b4d9e..00000000
Binary files a/Resources/StepBar.png and /dev/null differ
diff --git a/Resources/SwitchConfig.png b/Resources/SwitchConfig.png
deleted file mode 100644
index e2430d7d..00000000
Binary files a/Resources/SwitchConfig.png and /dev/null differ
diff --git a/Resources/TabControl.gif b/Resources/TabControl.gif
deleted file mode 100644
index d897226e..00000000
Binary files a/Resources/TabControl.gif and /dev/null differ
diff --git a/Resources/TabControl.png b/Resources/TabControl.png
deleted file mode 100644
index cfc6e8f9..00000000
Binary files a/Resources/TabControl.png and /dev/null differ
diff --git a/Resources/Tag.png b/Resources/Tag.png
deleted file mode 100644
index bed402fb..00000000
Binary files a/Resources/Tag.png and /dev/null differ
diff --git a/Resources/TextBlock.jpg b/Resources/TextBlock.jpg
deleted file mode 100644
index 308fca9c..00000000
Binary files a/Resources/TextBlock.jpg and /dev/null differ
diff --git a/Resources/TextBox.jpg b/Resources/TextBox.jpg
deleted file mode 100644
index 911925c9..00000000
Binary files a/Resources/TextBox.jpg and /dev/null differ
diff --git a/Resources/TimeBar.gif b/Resources/TimeBar.gif
deleted file mode 100644
index 0bba8301..00000000
Binary files a/Resources/TimeBar.gif and /dev/null differ
diff --git a/Resources/TimePicker.jpg b/Resources/TimePicker.jpg
deleted file mode 100644
index 66b4f3ed..00000000
Binary files a/Resources/TimePicker.jpg and /dev/null differ
diff --git a/Resources/ToggleButton.png b/Resources/ToggleButton.png
deleted file mode 100644
index 8741a375..00000000
Binary files a/Resources/ToggleButton.png and /dev/null differ
diff --git a/Resources/ToolBar.png b/Resources/ToolBar.png
deleted file mode 100644
index 7e42d323..00000000
Binary files a/Resources/ToolBar.png and /dev/null differ
diff --git a/Resources/Transfer.png b/Resources/Transfer.png
deleted file mode 100644
index a41ec233..00000000
Binary files a/Resources/Transfer.png and /dev/null differ
diff --git a/Resources/TreeView.png b/Resources/TreeView.png
deleted file mode 100644
index 37481a9c..00000000
Binary files a/Resources/TreeView.png and /dev/null differ
diff --git a/Resources/WaterfallPanel.png b/Resources/WaterfallPanel.png
deleted file mode 100644
index 3448f06e..00000000
Binary files a/Resources/WaterfallPanel.png and /dev/null differ
diff --git a/Resources/WaveProgressBar.gif b/Resources/WaveProgressBar.gif
deleted file mode 100644
index f41db6ce..00000000
Binary files a/Resources/WaveProgressBar.gif and /dev/null differ
diff --git a/Resources/icon.png b/Resources/icon.png
deleted file mode 100644
index 652eb767..00000000
Binary files a/Resources/icon.png and /dev/null differ
diff --git a/Resources/icon.svg b/Resources/icon.svg
deleted file mode 100644
index 641f73c0..00000000
--- a/Resources/icon.svg
+++ /dev/null
@@ -1,2 +0,0 @@
-
\ No newline at end of file
diff --git a/Resources/qq-group.png b/Resources/qq-group.png
deleted file mode 100644
index e4a34d78..00000000
Binary files a/Resources/qq-group.png and /dev/null differ
diff --git a/Resources/qrcode.png b/Resources/qrcode.png
deleted file mode 100644
index 72252708..00000000
Binary files a/Resources/qrcode.png and /dev/null differ
diff --git a/Resources/resharper_logo.png b/Resources/resharper_logo.png
deleted file mode 100644
index 1c1dec6d..00000000
Binary files a/Resources/resharper_logo.png and /dev/null differ
diff --git a/build/build.cake b/build/build.cake
new file mode 100644
index 00000000..7538862b
--- /dev/null
+++ b/build/build.cake
@@ -0,0 +1,70 @@
+var target = Argument("target", "Build");
+
+Task("Clean")
+ .Does(() =>
+{
+ CleanDirectory("lib");
+});
+
+Task("Build")
+ .IsDependentOn("Clean")
+ .Does(() =>
+{
+ var vsLatest = VSWhereLatest();
+ var msBuildPath = vsLatest?.CombineWithFilePath("./MSBuild/Current/Bin/MSBuild.exe");
+ NuGetRestore("../src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj");
+
+ var settingsNet40 = new MSBuildSettings
+ {
+ Configuration = "Release",
+ ToolPath = msBuildPath,
+ }.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net40")).FullPath);
+
+ var settingsNet45 = new MSBuildSettings
+ {
+ Configuration = "Release-Net45",
+ ToolPath = msBuildPath,
+ }.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net45")).FullPath);
+
+ var settingsNet462 = new MSBuildSettings
+ {
+ Configuration = "Release-Net462",
+ ToolPath = msBuildPath,
+ }.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net462")).FullPath);
+
+ var settingsNet47 = new MSBuildSettings
+ {
+ Configuration = "Release-Net47",
+ ToolPath = msBuildPath,
+ }.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net47")).FullPath);
+
+ var settingsNet48 = new MSBuildSettings
+ {
+ Configuration = "Release-Net48",
+ ToolPath = msBuildPath,
+ }.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net48")).FullPath);
+
+ var settingsCore30 = new DotNetCoreBuildSettings
+ {
+ Framework = "netcoreapp3.0",
+ Configuration = "Release-Core30",
+ OutputDirectory = "lib/netcoreapp3.0"
+ };
+
+ var settingsCore31 = new DotNetCoreBuildSettings
+ {
+ Framework = "netcoreapp3.1",
+ Configuration = "Release-Core31",
+ OutputDirectory = "lib/netcoreapp3.1"
+ };
+
+ MSBuild("../src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj", settingsNet40);
+ MSBuild("../src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj", settingsNet45);
+ MSBuild("../src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj", settingsNet462);
+ MSBuild("../src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj", settingsNet47);
+ MSBuild("../src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj", settingsNet48);
+ DotNetCoreBuild("../src/Core_GE30/HandyControl_Core_GE30/HandyControl_Core_GE30.csproj", settingsCore30);
+ DotNetCoreBuild("../src/Core_GE30/HandyControl_Core_GE30/HandyControl_Core_GE30.csproj", settingsCore31);
+});
+
+RunTarget(target);
\ No newline at end of file
diff --git a/build/build.nuspec b/build/build.nuspec
new file mode 100644
index 00000000..f48902dc
--- /dev/null
+++ b/build/build.nuspec
@@ -0,0 +1,70 @@
+
+
+
+ HandyControl
+ 2.4.0
+ HandyOrg
+ HandyOrg
+ HandyOrg
+ false
+ https://github.com/NaBian/HandyControl
+ https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/icon.png
+ Contains some commonly used simple WPF controls
+ Changes are detailed at https://github.com/HandyOrg/HandyControl/releases
+ Copyright © HandyOrg 2018-2020
+
+ WPF C# Control
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/build.ps1 b/build/build.ps1
new file mode 100644
index 00000000..23a48b73
--- /dev/null
+++ b/build/build.ps1
@@ -0,0 +1,256 @@
+##########################################################################
+# This is the Cake bootstrapper script for PowerShell.
+# This file was downloaded from https://github.com/cake-build/resources
+# Feel free to change this file to fit your needs.
+##########################################################################
+
+<#
+
+.SYNOPSIS
+This is a Powershell script to bootstrap a Cake build.
+
+.DESCRIPTION
+This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
+and execute your Cake build script with the parameters you provide.
+
+.PARAMETER Script
+The build script to execute.
+.PARAMETER Target
+The build script target to run.
+.PARAMETER Configuration
+The build configuration to use.
+.PARAMETER Verbosity
+Specifies the amount of information to be displayed.
+.PARAMETER ShowDescription
+Shows description about tasks.
+.PARAMETER DryRun
+Performs a dry run.
+.PARAMETER SkipToolPackageRestore
+Skips restoring of packages.
+.PARAMETER ScriptArgs
+Remaining arguments are added here.
+
+.LINK
+https://cakebuild.net
+
+#>
+
+[CmdletBinding()]
+Param(
+ [string]$Script = "build.cake",
+ [string]$Target,
+ [string]$Configuration,
+ [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
+ [string]$Verbosity,
+ [switch]$ShowDescription,
+ [Alias("WhatIf", "Noop")]
+ [switch]$DryRun,
+ [switch]$SkipToolPackageRestore,
+ [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
+ [string[]]$ScriptArgs
+)
+
+# Attempt to set highest encryption available for SecurityProtocol.
+# PowerShell will not set this by default (until maybe .NET 4.6.x). This
+# will typically produce a message for PowerShell v2 (just an info
+# message though)
+try {
+ # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
+ # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
+ # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
+ # installed (.NET 4.5 is an in-place upgrade).
+ # PowerShell Core already has support for TLS 1.2 so we can skip this if running in that.
+ if (-not $IsCoreCLR) {
+ [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
+ }
+ } catch {
+ Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
+ }
+
+[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
+function MD5HashFile([string] $filePath)
+{
+ if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf))
+ {
+ return $null
+ }
+
+ [System.IO.Stream] $file = $null;
+ [System.Security.Cryptography.MD5] $md5 = $null;
+ try
+ {
+ $md5 = [System.Security.Cryptography.MD5]::Create()
+ $file = [System.IO.File]::OpenRead($filePath)
+ return [System.BitConverter]::ToString($md5.ComputeHash($file))
+ }
+ finally
+ {
+ if ($file -ne $null)
+ {
+ $file.Dispose()
+ }
+ }
+}
+
+function GetProxyEnabledWebClient
+{
+ $wc = New-Object System.Net.WebClient
+ $proxy = [System.Net.WebRequest]::GetSystemWebProxy()
+ $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
+ $wc.Proxy = $proxy
+ return $wc
+}
+
+Write-Host "Preparing to run build script..."
+
+if(!$PSScriptRoot){
+ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
+}
+
+$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
+$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
+$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
+$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
+$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
+$NUGET_URL = "https://github.com/HandyOrg/HandyOrgResource/blob/master/Tools/nuget.exe?raw=true"
+$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
+$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
+$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
+$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
+
+# Make sure tools folder exists
+if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
+ Write-Verbose -Message "Creating tools directory..."
+ New-Item -Path $TOOLS_DIR -Type Directory | Out-Null
+}
+
+# Make sure that packages.config exist.
+if (!(Test-Path $PACKAGES_CONFIG)) {
+ Write-Verbose -Message "Downloading packages.config..."
+ try {
+ $wc = GetProxyEnabledWebClient
+ $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG)
+ } catch {
+ Throw "Could not download packages.config."
+ }
+}
+
+# Try find NuGet.exe in path if not exists
+if (!(Test-Path $NUGET_EXE)) {
+ Write-Verbose -Message "Trying to find nuget.exe in PATH..."
+ $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
+ $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
+ if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
+ Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
+ $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
+ }
+}
+
+# Try download NuGet.exe if not exists
+if (!(Test-Path $NUGET_EXE)) {
+ Write-Verbose -Message "Downloading NuGet.exe..."
+ try {
+ $wc = GetProxyEnabledWebClient
+ $wc.DownloadFile($NUGET_URL, $NUGET_EXE)
+ } catch {
+ Throw "Could not download NuGet.exe."
+ }
+}
+
+# Save nuget.exe path to environment to be available to child processed
+$env:NUGET_EXE = $NUGET_EXE
+$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
+ "mono `"$NUGET_EXE`""
+} else {
+ "`"$NUGET_EXE`""
+}
+
+# Restore tools from NuGet?
+if(-Not $SkipToolPackageRestore.IsPresent) {
+ Push-Location
+ Set-Location $TOOLS_DIR
+
+ # Check for changes in packages.config and remove installed tools if true.
+ [string] $md5Hash = MD5HashFile $PACKAGES_CONFIG
+ if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
+ ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
+ Write-Verbose -Message "Missing or changed package.config hash..."
+ Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
+ Remove-Item -Recurse -Force
+ }
+
+ Write-Verbose -Message "Restoring tools from NuGet..."
+
+ $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
+
+ if ($LASTEXITCODE -ne 0) {
+ Throw "An error occurred while restoring NuGet tools."
+ }
+ else
+ {
+ $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
+ }
+ Write-Verbose -Message ($NuGetOutput | Out-String)
+
+ Pop-Location
+}
+
+# Restore addins from NuGet
+if (Test-Path $ADDINS_PACKAGES_CONFIG) {
+ Push-Location
+ Set-Location $ADDINS_DIR
+
+ Write-Verbose -Message "Restoring addins from NuGet..."
+ $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
+
+ if ($LASTEXITCODE -ne 0) {
+ Throw "An error occurred while restoring NuGet addins."
+ }
+
+ Write-Verbose -Message ($NuGetOutput | Out-String)
+
+ Pop-Location
+}
+
+# Restore modules from NuGet
+if (Test-Path $MODULES_PACKAGES_CONFIG) {
+ Push-Location
+ Set-Location $MODULES_DIR
+
+ Write-Verbose -Message "Restoring modules from NuGet..."
+ $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
+
+ if ($LASTEXITCODE -ne 0) {
+ Throw "An error occurred while restoring NuGet modules."
+ }
+
+ Write-Verbose -Message ($NuGetOutput | Out-String)
+
+ Pop-Location
+}
+
+# Make sure that Cake has been installed.
+if (!(Test-Path $CAKE_EXE)) {
+ Throw "Could not find Cake.exe at $CAKE_EXE"
+}
+
+$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
+ "mono `"$CAKE_EXE`""
+} else {
+ "`"$CAKE_EXE`""
+}
+
+ # Build an array (not a string) of Cake arguments to be joined later
+$cakeArguments = @()
+if ($Script) { $cakeArguments += "`"$Script`"" }
+if ($Target) { $cakeArguments += "-target=`"$Target`"" }
+if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
+if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
+if ($ShowDescription) { $cakeArguments += "-showdescription" }
+if ($DryRun) { $cakeArguments += "-dryrun" }
+$cakeArguments += $ScriptArgs
+
+# Start Cake
+Write-Host "Running build script..."
+Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")"
+exit $LASTEXITCODE
diff --git a/doc/source/_posts/home.md b/doc/source/_posts/home.md
index cec7679d..b1667489 100644
--- a/doc/source/_posts/home.md
+++ b/doc/source/_posts/home.md
@@ -2,14 +2,18 @@
title: 欢迎来到HandyOrg
---
+# 关于我们
+
HandyOrg的宗旨是为用户提供最简单的API。
-我们一直期待着有更多的同学加入。
+我们一直期待有更多的同学加入。
-我们的入坑要求:
+# 入坑要求
- 热爱编码
- 接受目前Handy的代码风格,并尽量遵守
- 项目名必须以Handy为前缀
- 活着
-我们的QQ群:714704041
\ No newline at end of file
+# 参与讨论
+
+[](//shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1) [](//shang.qq.com/wpa/qunwpa?idkey=5c18622a0f6ee07a6f33afa8cdb85b1f72ea50e878271dfcec919c76b55afee7)
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/backgroundSwitchElement/index.md b/doc/source/handycontrol/attach/backgroundSwitchElement/index.md
index 2fa310da..9550dfc7 100644
--- a/doc/source/handycontrol/attach/backgroundSwitchElement/index.md
+++ b/doc/source/handycontrol/attach/backgroundSwitchElement/index.md
@@ -2,41 +2,43 @@
title: BackgroundSwitchElement 可切换背景的元素
---
-# 准备工作
-添加`HandyControl`命名空间
-{% code %}
-xmlns:hc="https://handyorg.github.io/handycontrol"
-{% endcode %}
+# 属性
-## MouseHoverBackground `鼠标悬浮背景色`
+| 名称 | 用途 |
+|-|-|
+| MouseHoverBackground | 设置鼠标悬浮背景色 |
+| MouseDownBackground | 设置鼠标按下背景色 |
-该附加属性常用于设置控件在鼠标悬浮时的背景色,在控件的样式或者模板中我们添加如下的触发器代码:
+# 使用案例
-{% code %}
+## MouseHoverBackground 设置鼠标悬浮背景色
+
+在样式或模板中我们添加如下的触发器代码:
+
+```xml
-
+
-{% endcode %}
+```
-随后我们就可以使用该属性了:
+前台使用方式:
-{% code %}
-<目标控件 controls:BackgroundSwitchElement.MouseHoverBackground ="Blue"/>
-{% endcode %}
+```xml
+<目标控件 hc:BackgroundSwitchElement.MouseHoverBackground ="Blue"/>
+```
-## MouseDownBackground `鼠标按下背景色`
+## MouseDownBackground 设置鼠标按下背景色
-该附加属性常用于设置控件在鼠标按下时的背景色,在控件的样式或者模板中我们添加如下的触发器代码:
+在样式或模板中我们添加如下的触发器代码:
-{% code %}
+```xml
-
+
-{% endcode %}
+```
-随后我们就可以使用该属性了:
+前台使用方式:
-{% code %}
-<目标控件 controls:BackgroundSwitchElement.MouseDownBackground ="Yellow"/>
-{% endcode %}
\ No newline at end of file
+```xml
+<目标控件 hc:BackgroundSwitchElement.MouseDownBackground ="Yellow"/>
+```
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/borderElement/index.md b/doc/source/handycontrol/attach/borderElement/index.md
index ca12ad62..1b75a0d4 100644
--- a/doc/source/handycontrol/attach/borderElement/index.md
+++ b/doc/source/handycontrol/attach/borderElement/index.md
@@ -1,5 +1,31 @@
---
-title: 建设中
+title: BorderElement 具有边框的元素
---
-建设中
\ No newline at end of file
+# 属性
+
+| 名称 | 用途 |
+|-|-|
+| CornerRadius | 设置边框圆角值 |
+| Circular | 是否呈现为圆形 True为是、False为否 |
+
+# 使用案例
+
+## CornerRadius 设置边框圆角值
+
+```xml
+
+
+
+
+```
+
+
+
+## Circular 是否呈现为圆形
+
+借助`BorderElement.Circular`附加属性实现圆形Border
+```xml
+
+```
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/dataGridAttach/index.md b/doc/source/handycontrol/attach/dataGridAttach/index.md
index ca12ad62..3cce6d65 100644
--- a/doc/source/handycontrol/attach/dataGridAttach/index.md
+++ b/doc/source/handycontrol/attach/dataGridAttach/index.md
@@ -1,5 +1,18 @@
---
-title: 建设中
+title: DataGridAttach DataGrid专用
---
-建设中
\ No newline at end of file
+该附加属性为hc内部DataGrid样式专用,不推荐直接使用。
+
+# 属性
+
+| 名称 | 用途 |
+|-|-|
+| ApplyDefaultStyle | 是否应用默认样式 |
+| TextColumnStyle | 文本列样式 |
+| EditingTextColumnStyle | 编辑时文本列样式 |
+| ComboBoxColumnStyle | 组合框列样式 |
+| EditingComboBoxColumnStyle | 编辑时组合框列样式 |
+| CheckBoxColumnStyle | 复选框列样式 |
+| EditingCheckBoxColumnStyle | 编辑时复选框列样式 |
+| ShowRowNumber | 是否显示行号 |
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/edgeElement/index.md b/doc/source/handycontrol/attach/edgeElement/index.md
index ca12ad62..846df55e 100644
--- a/doc/source/handycontrol/attach/edgeElement/index.md
+++ b/doc/source/handycontrol/attach/edgeElement/index.md
@@ -1,5 +1,13 @@
---
-title: 建设中
+title: EdgeElement 具有边界内容的元素
---
-建设中
\ No newline at end of file
+# 属性
+
+| 名称 | 用途 |
+|-|-|
+| LeftContent | 左侧边界内容 |
+| TopContent | 顶部边界内容 |
+| RightContent | 右侧边界内容 |
+| BottomContent | 底部边界内容 |
+| ShowEdgeContent | 是否显示边界内容 |
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/iconElement/index.md b/doc/source/handycontrol/attach/iconElement/index.md
index ca12ad62..7f45e196 100644
--- a/doc/source/handycontrol/attach/iconElement/index.md
+++ b/doc/source/handycontrol/attach/iconElement/index.md
@@ -1,5 +1,24 @@
---
-title: 建设中
+title: IconElement 具有图标的元素
---
-建设中
\ No newline at end of file
+# 属性
+
+| 名称 | 用途 |
+|-|-|
+| Geometry | 几何形状 |
+| Width | 图标宽度 |
+| Height | 图标高度 |
+
+# 使用案例
+
+## Geometry 几何形状
+
+```xml
+
+
+
+
+```
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/iconSwitchElement/index.md b/doc/source/handycontrol/attach/iconSwitchElement/index.md
index ca12ad62..adffe69d 100644
--- a/doc/source/handycontrol/attach/iconSwitchElement/index.md
+++ b/doc/source/handycontrol/attach/iconSwitchElement/index.md
@@ -1,5 +1,13 @@
---
-title: 建设中
+title: IconSwitchElement 可切换图标的元素
---
-建设中
\ No newline at end of file
+{% note info no-icon %}
+继承自 [IconElement](https://handyorg.github.io/handycontrol/attach/iconElement/)
+{% endnote %}
+
+# 属性
+
+| 名称 | 用途 |
+|-|-|
+| GeometrySelected | 选中时的几何形状 |
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/images/Attach.png b/doc/source/handycontrol/attach/images/Attach.png
deleted file mode 100644
index efda668e..00000000
Binary files a/doc/source/handycontrol/attach/images/Attach.png and /dev/null differ
diff --git a/doc/source/handycontrol/attach/index.md b/doc/source/handycontrol/attach/index.md
index c8aa438a..7b459d0e 100644
--- a/doc/source/handycontrol/attach/index.md
+++ b/doc/source/handycontrol/attach/index.md
@@ -4,6 +4,6 @@ title: 附加属性
附加属性源码在Controls / Attach文件夹中:
-
+
以`Element`结尾的类,可以为所有的控件设置一些共有的属性,以`Attach`结尾的类,只能为一种控件设置相关的属性。
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/infoElement/index.md b/doc/source/handycontrol/attach/infoElement/index.md
index ca12ad62..276af1f4 100644
--- a/doc/source/handycontrol/attach/infoElement/index.md
+++ b/doc/source/handycontrol/attach/infoElement/index.md
@@ -1,5 +1,69 @@
---
-title: 建设中
+title: InfoElement 信息元素
---
-建设中
\ No newline at end of file
+{% note info no-icon %}
+
+继承自 [TitleElement]( https://handyorg.github.io/handycontrol/attach/titleElement/ )
+
+{% endnote%}
+
+# 属性
+
+| 名称 | 用途 |
+| ---------------- | ------------------ |
+| Placeholder | 占位符(输入提示) |
+| Necessary | 是否必填 |
+| Symbol | 标记信息 |
+| ContentHeight | 内容高度 |
+| MinContentHeight | 最小内容高度 |
+| MaxContentHeight | 最大内容高度 |
+
+# 使用案例
+
+## Placeholder 占位符
+
+```xml
+
+
+
+
+```
+
+
+
+## Necessary 是否必填
+
+```xml
+
+```
+
+其中`hc:InfoElement.Title="查询条件" `继承自父类
+
+
+
+## Symbol 标记信息
+
+```xml
+
+```
+
+
+
+## ContentHeight 内容高度
+
+```xml
+
+```
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/panelElement/index.md b/doc/source/handycontrol/attach/panelElement/index.md
index ca12ad62..9267ff42 100644
--- a/doc/source/handycontrol/attach/panelElement/index.md
+++ b/doc/source/handycontrol/attach/panelElement/index.md
@@ -1,5 +1,19 @@
---
-title: 建设中
+title: PanelElement 面板元素
---
-建设中
\ No newline at end of file
+# 属性
+
+| 名称 | 用途 |
+|-|-|
+| FluidMoveBehavior | 设置面板的流体移动方式 |
+
+# 使用案例
+
+## FluidMoveBehavior 设置面板的流体移动方式
+
+```xml
+
+```
+
+当向面板容器中添加或移除元素时,就可以看到流体移动的动画效果。
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/passwordBoxAttach/index.md b/doc/source/handycontrol/attach/passwordBoxAttach/index.md
index ca12ad62..cb29f06d 100644
--- a/doc/source/handycontrol/attach/passwordBoxAttach/index.md
+++ b/doc/source/handycontrol/attach/passwordBoxAttach/index.md
@@ -1,5 +1,12 @@
---
-title: 建设中
+title: PasswordBoxAttach 密码框专用
---
-建设中
\ No newline at end of file
+该附加属性为hc内部密码框样式专用,不推荐直接使用。
+
+# 属性
+
+| 名称 | 用途 |
+| -------------- | -------- |
+| IsMonitoring | 是否监测密码长度 |
+| PasswordLength | 密码长度 |
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/rectangleAttach/index.md b/doc/source/handycontrol/attach/rectangleAttach/index.md
new file mode 100644
index 00000000..4999a04b
--- /dev/null
+++ b/doc/source/handycontrol/attach/rectangleAttach/index.md
@@ -0,0 +1,19 @@
+---
+title: RectangleAttach Rectangle专用
+---
+
+# 属性
+
+| 名称 | 用途 |
+|-|-|
+| CornerRadius | 设置Rectangle圆角值 |
+
+# 使用案例
+
+## CornerRadius 设置Rectangle圆角值
+
+```xml
+
+```
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/statusSwitchElement/index.md b/doc/source/handycontrol/attach/statusSwitchElement/index.md
index ca12ad62..6b309eb8 100644
--- a/doc/source/handycontrol/attach/statusSwitchElement/index.md
+++ b/doc/source/handycontrol/attach/statusSwitchElement/index.md
@@ -1,5 +1,81 @@
---
-title: 建设中
+title: StatusSwitchElement 可切换状态的元素
---
-建设中
\ No newline at end of file
+# 属性
+
+| 名称 | 用途 |
+| -------------------- | ---------------- |
+| CheckedElement | 选中时展示的元素 |
+| HideUncheckedElement | 是否隐藏元素 |
+
+# 使用案例
+
+## CheckedElement 选中时展示的元素
+
+此附加属性适用于`ToggleButton`以及子类控件,用于控制选择类控件选中时需要显示的内容,默认值为`False`,不显示。
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+默认状态(非选中时)和选中状态
+
+
+
+## HideUncheckedElement 是否隐藏元素
+
+当控制在选中状态时,是否隐藏默认内容,默认值为`False`,不隐藏
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+效果:
+
+
+
+{% note info no-icon %}
+
+以上两个属性,组合使用,能够简单的控制选择类控件状态的展示功能,可根据以上案例进行合理调整
+
+{% endnote %}
+
diff --git a/doc/source/handycontrol/attach/textBlockAttach/index.md b/doc/source/handycontrol/attach/textBlockAttach/index.md
new file mode 100644
index 00000000..bf355d3f
--- /dev/null
+++ b/doc/source/handycontrol/attach/textBlockAttach/index.md
@@ -0,0 +1,21 @@
+---
+title: TextBlockAttach 文本块专用
+---
+
+# 属性
+
+| 名称 | 用途 |
+|-|-|
+| AutoTooltip | 设置是否自动显示工具提示 |
+
+# 使用案例
+
+## AutoTooltip 设置是否自动显示工具提示
+
+```xml
+
+
+
+```
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/tipElement/index.md b/doc/source/handycontrol/attach/tipElement/index.md
index ca12ad62..6b91f48d 100644
--- a/doc/source/handycontrol/attach/tipElement/index.md
+++ b/doc/source/handycontrol/attach/tipElement/index.md
@@ -1,5 +1,42 @@
---
-title: 建设中
+title: TipElement 提示元素
---
-建设中
\ No newline at end of file
+# 属性
+
+| 名称 | 用途 |
+| ---------- | -------- |
+| Placement | 提示元素显示位置 |
+| Visibility | 是否可见 |
+
+
+# 使用案例
+
+## Placement 提示元素显示位置
+
+该属性,用于设定提示元素显示位置,目前支持BottomRight和TopLeft(默认值)
+
+```
+
+
+```
+
+效果
+
+
+
+
+
diff --git a/doc/source/handycontrol/attach/titleElement/index.md b/doc/source/handycontrol/attach/titleElement/index.md
index ca12ad62..7a86e9e0 100644
--- a/doc/source/handycontrol/attach/titleElement/index.md
+++ b/doc/source/handycontrol/attach/titleElement/index.md
@@ -1,5 +1,57 @@
---
-title: 建设中
+title: TitleElement 标题元素
---
-建设中
\ No newline at end of file
+# 属性
+
+| 名称 | 用途 |
+| -------------- | ------------ |
+| Title | 标题信息 |
+| Background | 标题背景色 |
+| Foreground | 标题字体色 |
+| BorderBrush | 标题边框色 |
+| TitleAlignment | 标题对齐方式 |
+| TitleWidth | 标题宽度 |
+
+# 使用案例
+
+## Title 标题信息
+
+```xml
+
+```
+
+
+
+## TitleAlignment 标题对齐方式
+
+```xml
+
+
+
+
+```
+
+
+
+## TitleWidth 标题宽度
+
+```xml
+
+
+
+
+```
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/visualElement/index.md b/doc/source/handycontrol/attach/visualElement/index.md
index ca12ad62..548af7e3 100644
--- a/doc/source/handycontrol/attach/visualElement/index.md
+++ b/doc/source/handycontrol/attach/visualElement/index.md
@@ -1,5 +1,77 @@
---
-title: 建设中
+title: VisualElement 可视化元素
---
-建设中
\ No newline at end of file
+# 属性
+
+| 名称 | 用途 |
+| -------------- | ---------------- |
+| HighlightBrush | 设置控件高亮颜色 |
+| Text | 设置文本内容 |
+
+# 使用案例
+
+## HighlightBrush 设置控件高亮颜色
+
+```xml
+
+
+
+
+```
+
+如下截图为一组选中状态时的高亮对比结果,左图为样式`默认颜色`,右侧为个人`自定义颜色`
+
+
+
+## Text 设置文本内容
+
+主要用于设置控件的辅助文本,当控件没有合适的属性用于显示文本时,可通过此附加属性在自定义样式中设置。
+
+例如:当自定义进度条,需要显示文本时,本身缺少显示额外文本内容的属性,可以通过自定样式显示对应文本,以`Text`作为文本内容承载属性
+
+自定义样式:
+
+```xml
+
+```
+
+`xaml`中的使用:
+
+```xml
+
+
+
+```
+
+效果:
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/attach/windowAttach/index.md b/doc/source/handycontrol/attach/windowAttach/index.md
index ca12ad62..5847a3a4 100644
--- a/doc/source/handycontrol/attach/windowAttach/index.md
+++ b/doc/source/handycontrol/attach/windowAttach/index.md
@@ -1,5 +1,54 @@
---
-title: 建设中
+title: WindowAttach 窗体专用
---
-建设中
\ No newline at end of file
+# 属性
+
+| 名称 | 用途 |
+| ----------------- | ------------------------------------------------------------ |
+| IsDragElement | 是否允许当前元素可拖动窗体 |
+| IgnoreAltF4 | 是否忽略快捷键Alt和F4(键盘快速退出或者 结束 当前正在运行的应用程序) |
+| ShowInTaskManager | 是否窗体显示到任务管理器中 |
+
+# 使用案例
+
+## IsDragElement 是否允许当前元素可拖动窗体
+
+```xml
+
+
+
+
+
+
+
+
+
+```
+
+可在深色框区域鼠标拖动窗体
+
+
+
+## IgnoreAltF4 是否忽略快捷键Alt和F4
+
+用于屏蔽窗口的 Alt+F4 关闭功能。
+
+```xml
+
+```
+
+## ShowInTaskManager 是否将窗体显示到任务管理器中
+
+使用前提:
+
+- 窗口必须为非模态窗口,即不能使用`ShowDialog`显示窗口。
+- 窗口必须同时设置`ShowInTaskBar`为`false`
+
+ps:该附加属性在`Windows7`中效果不是很明显
\ No newline at end of file
diff --git a/doc/source/handycontrol/basic_xaml/converters/index.md b/doc/source/handycontrol/basic_xaml/converters/index.md
index 8b936e70..6d256584 100644
--- a/doc/source/handycontrol/basic_xaml/converters/index.md
+++ b/doc/source/handycontrol/basic_xaml/converters/index.md
@@ -22,13 +22,21 @@ title: 转换器
该转换器会将布尔数组转换为`Visibility`,当数组内全部为`true`时,返回`Visible`,否则返回`Collapse`。
+# BorderCircularClipConverter
+
+该转换器为Border专用,接受一个object数组,该数组长度为3,分别对应Border的长、宽和圆角半径,它会返回一个圆形几何形状作为Clip来剪裁Border。
+
# BorderCircularConverter
该转换器为Border专用,接受`Border`的长和宽合成的一个整型数组,返回它们中最小值的一半,作为圆形Border的半径。
# BorderClipConverter
-该转换器为Border专用,接受一个object数组,该数组长度为3,分别对应Border的长、宽和圆角半径,它会返回一个圆形几何形状作为Clip来剪裁Border。
+该转换器为Border专用,接受一个object数组,该数组长度为3,分别对应Border的长、宽和圆角半径,它会返回一个圆角矩形作为Clip来剪裁Border。
+
+# ColLayoutConverter
+
+该转换器用于xaml设计时,主要功能是将字符串转换为有效的`ColLayout`值。
# Color2ChannelAConverter(内部使用)
@@ -38,6 +46,18 @@ title: 转换器
该转换器会将`SolidColorBrush`转换为16进制字符串形式(带“#”)。
+# CornerRadiusSplitConverter
+
+该转换器需要提供一个字符串作为参数,该字符串的一般形式为:`[0/1],[0/1],[0/1],[0/1]`,4个以逗号分隔的值分别对应`CornerRadius`的`Left`、`Top`,`Right`,`Bottom`属性,当值为1则返回对应属性的值,否则返回0。
+
+# Double2GridLengthConverter
+
+该转换器会将`double`值转换为`GridLength`。
+
+# DoubleMinConverter(内部使用)
+
+可以向该转换器提供一个字符串作为最小值(如果不提供,则最小值默认为0),当传入的值小于最小值时,返回最小值,否则返回传入的值。
+
# Int2StrConverter
该转换器需要提供一个字符串作为参数,该字符串的一般形式为:`[字符串0];[字符串1];...[字符串n]`,转换器会将一个整型的值作为索引,来获取指定位置的字符串并返回。
@@ -46,6 +66,10 @@ title: 转换器
该转换器会将长整型转换为文件大小的字符串。
+# Number2PercentageConverter
+
+该转换器接受一个长度为2的数字数组,返回两数的百分比值。
+
# Object2BooleanConverter
如果该转换器获取到的值为`null`则返回`false`,否则返回`true`。
@@ -54,6 +78,10 @@ title: 转换器
如果该转换器获取到的值为`null`则返回`Collapsed`,否则返回`Visible`。
+# RectangleCircularConverter
+
+该转换器为Rectangle专用,接受`Rectangle`的长和宽合成的一个整型数组,返回它们中最小值的一半,作为圆形Rectangle的半径。
+
# String2VisibilityConverter
该转换器接受一个字符串,如果该字符串为空或者为null,则返回`Collapse`,否则返回`Visible`。
@@ -62,6 +90,10 @@ title: 转换器
该转换器情况与`String2VisibilityConverter`相反。
+# ThicknessSplitConverter
+
+该转换器需要提供一个字符串作为参数,该字符串的一般形式为:`[0/1],[0/1],[0/1],[0/1]`,4个以逗号分隔的值分别对应`Thickness`的`Left`、`Top`,`Right`,`Bottom`属性,当值为1则返回对应属性的值,否则返回0。
+
# TreeViewItemMarginConverter(内部使用)
该转换器用于为TreeViewItem提供适当的左边距。
diff --git a/doc/source/handycontrol/basic_xaml/geometries/index.md b/doc/source/handycontrol/basic_xaml/geometries/index.md
index 7304c03f..3d01060e 100644
--- a/doc/source/handycontrol/basic_xaml/geometries/index.md
+++ b/doc/source/handycontrol/basic_xaml/geometries/index.md
@@ -16,6 +16,7 @@ HandyControl中自带了一些几何形状定义,但要应用于生产中显
| LeftGeometry | 左 |
| RightGeometry | 右 |
| RotateLeftGeometry | 向左旋转 |
+| RotateRightGeometry | 向左旋转 |
| EnlargeGeometry | 放大 |
| ReduceGeometry | 缩小 |
| DownloadGeometry | 下载 |
@@ -28,6 +29,12 @@ HandyControl中自带了一些几何形状定义,但要应用于生产中显
| WindowMinGeometry | 窗口最小化 |
| WindowRestoreGeometry | 窗口还原 |
| WindowMaxGeometry | 窗口最大化 |
+| CheckedGeometry | 选中 |
+| PageModeGeometry | 单页模式 |
+| TwoPageModeGeometry | 双页模式 |
+| ScrollModeGeometry | 滚动模式 |
+| EyeOpenGeometry | 睁眼 |
+| EyeCloseGeometry | 闭眼 |
| AudioGeometry | 声音 |
| BubbleTailGeometry | 气泡的尾巴 |
| StarGeometry | 爱心 |
diff --git a/doc/source/handycontrol/basic_xaml/images/Basic_Structure.png b/doc/source/handycontrol/basic_xaml/images/Basic_Structure.png
deleted file mode 100644
index a6a25bec..00000000
Binary files a/doc/source/handycontrol/basic_xaml/images/Basic_Structure.png and /dev/null differ
diff --git a/doc/source/handycontrol/basic_xaml/index.md b/doc/source/handycontrol/basic_xaml/index.md
index 273f7885..8d187f3b 100644
--- a/doc/source/handycontrol/basic_xaml/index.md
+++ b/doc/source/handycontrol/basic_xaml/index.md
@@ -3,7 +3,7 @@ title: 基础xaml定义
---
基础xaml定义都在Basic文件夹中,其内部结构如下:
-
+
对它们的描述如下表所示:
diff --git a/doc/source/handycontrol/basic_xaml/sizes/index.md b/doc/source/handycontrol/basic_xaml/sizes/index.md
index e8b38ee2..2fbb6e0f 100644
--- a/doc/source/handycontrol/basic_xaml/sizes/index.md
+++ b/doc/source/handycontrol/basic_xaml/sizes/index.md
@@ -5,7 +5,7 @@ title: 尺寸
| 名称 | 类型 | 值 | 描述 |
|-|-|
| DefaultControlHeight | System.Double | 30 | 默认控件高度 |
-| DefaultControlPadding | System.Windows.Thickness | 12,6 | 默认控件内边距 |
+| DefaultControlPadding | System.Windows.Thickness | 10,6 | 默认控件内边距 |
| DefaultInputPadding | System.Windows.Thickness | 8,6 |默认输入控件内边距 |
| DefaultCornerRadius | System.Windows.CornerRadius | 4 | 默认圆角 |
diff --git a/doc/source/handycontrol/extend_controls/buttonGroup/index.md b/doc/source/handycontrol/extend_controls/buttonGroup/index.md
new file mode 100644
index 00000000..32d31e77
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/buttonGroup/index.md
@@ -0,0 +1,77 @@
+---
+title: ButtonGroup 按钮组
+---
+
+# RadioGroupItemBaseStyle
+
+`ButtonGroup`控件中的子集`RadioButton`样式基类,不建议直接使用,常作为`ButtonGroup`中`Item`样式基类,同时与`ButtonGroup`控件配套使用
+
+案例:
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+效果:
+
+
+
+# RadioGroup关联样式
+
+| 样式Key | 用途 | 基类样式 |
+| ----------------------------- | ------------------------------------ | ----------------------- |
+| RadioGroupItemDefault | RadioGroupItem默认样式 | RadioGroupItemBaseStyle |
+| RadioGroupItemHorizontalFirst | RadioGroupItem水平头样式(从左至右) | RadioGroupItemBaseStyle |
+| RadioGroupItemHorizontalLast | RadioGroupItem水平尾样式(从左至右) | RadioGroupItemBaseStyle |
+| RadioGroupItemSingle | RadioGroupItem单项样式 | RadioGroupItemBaseStyle |
+| RadioGroupItemVerticalFirst | RadioGroupItem垂直头样式(从上至下) | RadioGroupItemBaseStyle |
+| RadioGroupItemVerticalLast | RadioGroupItem垂直尾样式(从上至下) | RadioGroupItemBaseStyle |
+
+案例:
+
+单个`RadioButton`样式:
+
+```xml
+
+```
+
+效果:
+
+
+
+多个`RadioButton`垂直样式:
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+效果:
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/extend_controls/calendarWithClock/index.md b/doc/source/handycontrol/extend_controls/calendarWithClock/index.md
index ca12ad62..1705ddf9 100644
--- a/doc/source/handycontrol/extend_controls/calendarWithClock/index.md
+++ b/doc/source/handycontrol/extend_controls/calendarWithClock/index.md
@@ -1,5 +1,66 @@
---
-title: 建设中
+title: CalendarWithClock
---
-建设中
\ No newline at end of file
+
+CalendarWithClock 控件由日历和时钟组成,允许用户通过鼠标选择日期和时间。
+
+``` CS
+[TemplatePart(Name = ElementButtonConfirm, Type = typeof(Button))]
+[TemplatePart(Name = ElementClockPresenter, Type = typeof(ContentPresenter))]
+[TemplatePart(Name = ElementCalendarPresenter, Type = typeof(ContentPresenter))]
+public class CalendarWithClock : Control
+```
+
+# 创建日期选取器
+
+``` XML
+
+```
+
+``` CS
+var dateTimePicker = new CalendarWithClock();
+```
+
+生成的CalendarWithClock如下图所示:
+
+
+
+
+
+# 选择日期和时间
+
+通过鼠标分别在日历和时钟上选择日期和时间,然后点击 **确定** 按钮即可更新CalendarWithClock控件的日期和时间。
+
+
+也可以在XAML钟或代码中这样设置日期。
+
+``` XML
+
+```
+
+``` CS
+calendarWithClock.SelectedDateTime = DateTime.Now;
+```
+
+
+
+# 属性
+
+| 属性 | 描述 |
+| ---------------- | ------------------ |
+| SelectedDateTime | 获取或设置当前选中的日期和时间 |
+| DateTimeFormat | 获取或设置用于显示选定日期和时间的格式 |
+| DisplayDateTime | 获取或设置要显示的日期 |
+| ShowConfirmButton | 获取或设置一个值,该值指示是是否显示 **确定** 按钮 |
+| VerifyFunc | 获取或设置数据验证委托 |
+| IsError | 获取或设置数据是否错误 |
+| ErrorStr | 获取或设置错误提示 |
+| TextType | 获取或设置文本类型 |
+| ShowClearButton | 获取或设置是否显示清除按钮 |
+
+# 方法
+
+| 方法 | 描述 |
+| ---------------- | ------------------ |
+| VerifyData() | 验证数据 |
\ No newline at end of file
diff --git a/doc/source/handycontrol/extend_controls/card/index.md b/doc/source/handycontrol/extend_controls/card/index.md
new file mode 100644
index 00000000..877d2fd6
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/card/index.md
@@ -0,0 +1,3 @@
+---
+title: Card
+---
diff --git a/doc/source/handycontrol/extend_controls/datePicker/index.md b/doc/source/handycontrol/extend_controls/datePicker/index.md
index ca12ad62..f61a8282 100644
--- a/doc/source/handycontrol/extend_controls/datePicker/index.md
+++ b/doc/source/handycontrol/extend_controls/datePicker/index.md
@@ -1,5 +1,74 @@
---
-title: 建设中
+title: DatePicker
---
-建设中
\ No newline at end of file
+DatePicker 控件允许用户通过在文本框中键入日期或使用下拉的日历控件来选择日期。
+
+``` CS
+[TemplatePart(Name = ElementTextBox, Type = typeof(DatePickerTextBox))]
+public class DatePicker : System.Windows.Controls.DatePicker, IDataInput
+```
+
+# 创建DatePicker
+
+``` XML
+
+```
+
+``` CS
+var datePicker = new DatePicker();
+```
+
+生成的DatePicker如下图所示:
+
+
+
+
+
+# 选择日期
+
+可以通过文本框输入日期,或者点击文本框右边的按钮打开下拉的日历控件选择日期。
+
+
+
+也可以在XAML钟或代码中这样设置日期。
+
+``` XML
+
+```
+
+``` CS
+datePicker.SelectedDate = DateTime.Now;
+```
+
+# 设置标题和占位符文本
+
+你可以将 Header(标题)和 Placeholder(占位符)添加到DatePicker,以向用户指示其用途。
+
+``` XML
+
+```
+
+
+
+
+# 属性
+
+| 属性 | 描述 |
+| ---------------- | ------------------ |
+| SelectedDate | 获取或设置当前选中的日期 |
+| VerifyFunc | 获取或设置数据验证委托 |
+| IsError | 获取或设置数据是否错误 |
+| ErrorStr | 获取或设置错误提示 |
+| TextType | 获取或设置文本类型 |
+| ShowClearButton | 获取或设置是否显示清除按钮 |
+
+# 方法
+
+| 方法 | 描述 |
+| ---------------- | ------------------ |
+| VerifyData() | 验证数据 |
+
diff --git a/doc/source/handycontrol/extend_controls/dateTimePicker/index.md b/doc/source/handycontrol/extend_controls/dateTimePicker/index.md
index ca12ad62..8dbbe027 100644
--- a/doc/source/handycontrol/extend_controls/dateTimePicker/index.md
+++ b/doc/source/handycontrol/extend_controls/dateTimePicker/index.md
@@ -1,5 +1,82 @@
---
-title: 建设中
+title: DateTimePicker
---
-建设中
\ No newline at end of file
+
+DatePicker 控件允许用户通过在文本框中键入日期和时间,或使用下拉的日历控件来选择日期和时间。
+
+``` CS
+[TemplatePart(Name = ElementRoot, Type = typeof(Grid))]
+[TemplatePart(Name = ElementTextBox, Type = typeof(WatermarkTextBox))]
+[TemplatePart(Name = ElementButton, Type = typeof(Button))]
+[TemplatePart(Name = ElementPopup, Type = typeof(Popup))]
+public class DateTimePicker : Control, IDataInput
+```
+
+# 创建DateTimePicker
+
+``` XML
+
+```
+
+``` CS
+var dateTimePicker = new DateTimePicker();
+```
+
+生成的DateTimePicker如下图所示:
+
+
+
+
+
+# 选择日期和时间
+
+可以通过文本框输入日期和时间,或者点击文本框右边的按钮打开下拉的日历和时钟控件选择日期和时间。
+
+
+
+也可以在XAML中或代码中这样设置日期。
+
+``` XML
+
+```
+
+``` CS
+dateTimePicker.SelectedDateTime = DateTime.Now;
+```
+
+# 设置标题和占位符文本
+
+你可以将 Header(标题)和 Placeholder(占位符)添加到DatePicker,以向用户指示其用途。要使用这两个属性,首先需要应用 **DateTimePickerExtend** 或 **DateTimePickerPlus** 样式。
+
+``` XML
+
+```
+
+
+
+
+# 属性
+
+| 属性 | 描述 |
+| ---------------- | ------------------ |
+| SelectedDateTime | 获取或设置当前选中的日期和时间 |
+| DateTimeFormat | 获取或设置用于显示选定日期和时间的格式 |
+| CalendarStyle | 获取或设置在呈现日历时使用的样式 |
+| DisplayDateTime | 获取或设置要显示的日期 |
+| IsDropDownOpen | 获取或设置一个值,该值指示是打开还是关闭下拉 Calendar |
+| Text | 获取由 **DateTimePicker** 显示的文本,或设置选定日期和时间 |
+| VerifyFunc | 获取或设置数据验证委托 |
+| IsError | 获取或设置数据是否错误 |
+| ErrorStr | 获取或设置错误提示 |
+| TextType | 获取或设置文本类型 |
+| ShowClearButton | 获取或设置是否显示清除按钮 |
+
+# 方法
+
+| 方法 | 描述 |
+| ---------------- | ------------------ |
+| VerifyData() | 验证数据 |
\ No newline at end of file
diff --git a/doc/source/handycontrol/extend_controls/divider/index.md b/doc/source/handycontrol/extend_controls/divider/index.md
new file mode 100644
index 00000000..c0af413b
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/divider/index.md
@@ -0,0 +1,3 @@
+---
+title: Divider
+---
diff --git a/doc/source/handycontrol/extend_controls/drawer/index.md b/doc/source/handycontrol/extend_controls/drawer/index.md
new file mode 100644
index 00000000..03c8a6ac
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/drawer/index.md
@@ -0,0 +1,3 @@
+---
+title: Drawer
+---
diff --git a/doc/source/handycontrol/extend_controls/floatingBlock/index.md b/doc/source/handycontrol/extend_controls/floatingBlock/index.md
new file mode 100644
index 00000000..7eb12950
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/floatingBlock/index.md
@@ -0,0 +1,3 @@
+---
+title: FloatingBlock
+---
diff --git a/doc/source/handycontrol/extend_controls/glowWindow/index.md b/doc/source/handycontrol/extend_controls/glowWindow/index.md
new file mode 100644
index 00000000..bf0d4873
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/glowWindow/index.md
@@ -0,0 +1,3 @@
+---
+title: GlowWindow
+---
diff --git a/doc/source/handycontrol/extend_controls/grid/index.md b/doc/source/handycontrol/extend_controls/grid/index.md
new file mode 100644
index 00000000..d52f1876
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/grid/index.md
@@ -0,0 +1,3 @@
+---
+title: Grid
+---
diff --git a/doc/source/handycontrol/extend_controls/growl/index.md b/doc/source/handycontrol/extend_controls/growl/index.md
index 8a7b8c0e..744b2956 100644
--- a/doc/source/handycontrol/extend_controls/growl/index.md
+++ b/doc/source/handycontrol/extend_controls/growl/index.md
@@ -6,7 +6,7 @@ title: Growl 信息通知
# 控件效果
-
+
# 准备工作
diff --git a/doc/source/handycontrol/extend_controls/honeycombPanel/index.md b/doc/source/handycontrol/extend_controls/honeycombPanel/index.md
new file mode 100644
index 00000000..9189a4e7
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/honeycombPanel/index.md
@@ -0,0 +1,3 @@
+---
+title: HoneycombPanel
+---
diff --git a/doc/source/handycontrol/extend_controls/imageBlock/index.md b/doc/source/handycontrol/extend_controls/imageBlock/index.md
new file mode 100644
index 00000000..004fee45
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/imageBlock/index.md
@@ -0,0 +1,3 @@
+---
+title: ImageBlock
+---
diff --git a/doc/source/handycontrol/extend_controls/magnifier/index.md b/doc/source/handycontrol/extend_controls/magnifier/index.md
new file mode 100644
index 00000000..e9cd70d1
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/magnifier/index.md
@@ -0,0 +1,3 @@
+---
+title: Magnifier
+---
diff --git a/doc/source/handycontrol/extend_controls/notification/index.md b/doc/source/handycontrol/extend_controls/notification/index.md
new file mode 100644
index 00000000..92b4119e
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/notification/index.md
@@ -0,0 +1,3 @@
+---
+title: Notification
+---
diff --git a/doc/source/handycontrol/extend_controls/numericUpDown/index.md b/doc/source/handycontrol/extend_controls/numericUpDown/index.md
index ca12ad62..ad0773ae 100644
--- a/doc/source/handycontrol/extend_controls/numericUpDown/index.md
+++ b/doc/source/handycontrol/extend_controls/numericUpDown/index.md
@@ -1,5 +1,105 @@
---
-title: 建设中
+title: NumericUpDown 数值选择控件
---
-建设中
\ No newline at end of file
+NumericUpDown 控件看起来像一对用户可以单击来调整值的箭头按钮和TextBox的组合,该控件显示并设置数值(Value)。 用户可以通过单击向上和向下箭头,或通过在控件的TextBox部分中键入一个数字来改变Value。
+
+``` CS
+[TemplatePart(Name = ElementTextBox, Type = typeof(DatePickerTextBox))]
+public class DatePicker : System.Windows.Controls.DatePicker, IDataInput
+```
+
+# 创建NumericUpDown并设置Value
+
+``` XML
+
+```
+
+``` CS
+var numericUpDown = new NumericUpDown();
+numericUpDown.Value = 100;
+```
+
+生成的NumericUpDown如下图所示:
+
+
+
+
+# 设置DecimalPlaces
+
+如果需要改变Value显示的小数位数,可以改变DecimalPlaces。DecimalPlaces是一个 **int?** 类型,当它为null时不限制显示的小数位数,否则显示的小数位数为DecimalPlaces的Value。
+
+``` XML
+
+```
+
+``` CS
+numericUpDown.Value = 10.12345;
+numericUpDown.DecimalPlaces = 2;
+```
+
+
+
+# 设置Increment
+
+可以通设置Increment改变单击一下按钮时增加或减少的数量。
+
+``` XML
+
+```
+
+``` CS
+numericUpDown.Increment = 10;
+```
+
+# 设置上限和下限
+
+可以通设置Maximum和Minimum限制Value的上限和下限。
+
+``` XML
+
+```
+
+``` CS
+numericUpDown.Minimum = 10;
+numericUpDown.Maximum = 1000;
+```
+
+# 设置标题和占位符文本
+
+你可以将 Header(标题)和 Placeholder(占位符)添加到NumericUpDown,以向用户指示其用途。要使用这两个附加属性,需要先应用 **NumericUpDownPlus** 样式。
+
+``` XML
+
+```
+
+
+
+# 属性
+
+| 属性 | 描述 |
+| ---------------- | ------------------ |
+| Value | 获取或设置当前值 |
+| Maximum | 获取或设置最大允许值 |
+| Minimum | 获取或设置最小允许值 |
+| Increment | 获取或设置单击向上或向下按钮时,数字显示框(也称作 up-down 控件)递增或递减的值。 |
+| DecimalPlaces |获取或设置NumericUpDown中要显示的十进制位数。 此属性不会影响 Value 属性。 |
+| VerifyFunc | 获取或设置数据验证委托 |
+| IsError | 获取或设置数据是否错误 |
+| ErrorStr | 获取或设置错误提示 |
+| TextType | 获取或设置文本类型 |
+| ShowClearButton | 获取或设置是否显示清除按钮 |
+
+# 方法
+
+| 方法 | 描述 |
+| ---------------- | ------------------ |
+| VerifyData() | 验证数据 |
+
+# 事件
+
+| 事件 | 描述 |
+| ---------------- | ------------------ |
+| ValueChanged | 在以某种方式更改 Value 属性后发生。 |
diff --git a/doc/source/handycontrol/extend_controls/pinBox/index.md b/doc/source/handycontrol/extend_controls/pinBox/index.md
new file mode 100644
index 00000000..2f0ef4cf
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/pinBox/index.md
@@ -0,0 +1,3 @@
+---
+title: PinBox
+---
diff --git a/doc/source/handycontrol/extend_controls/popTip/index.md b/doc/source/handycontrol/extend_controls/popTip/index.md
new file mode 100644
index 00000000..e28dfc77
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/popTip/index.md
@@ -0,0 +1,3 @@
+---
+title: PopTip
+---
diff --git a/doc/source/handycontrol/extend_controls/rangeSlider/index.md b/doc/source/handycontrol/extend_controls/rangeSlider/index.md
new file mode 100644
index 00000000..d8671ff6
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/rangeSlider/index.md
@@ -0,0 +1,3 @@
+---
+title: RangeSlider
+---
diff --git a/doc/source/handycontrol/extend_controls/relativePanel/index.md b/doc/source/handycontrol/extend_controls/relativePanel/index.md
new file mode 100644
index 00000000..81349147
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/relativePanel/index.md
@@ -0,0 +1,3 @@
+---
+title: RelativePanel
+---
diff --git a/doc/source/handycontrol/extend_controls/runningBlock/index.md b/doc/source/handycontrol/extend_controls/runningBlock/index.md
new file mode 100644
index 00000000..474bc528
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/runningBlock/index.md
@@ -0,0 +1,3 @@
+---
+title: RunningBlock
+---
diff --git a/doc/source/handycontrol/extend_controls/sideMenu/index.md b/doc/source/handycontrol/extend_controls/sideMenu/index.md
new file mode 100644
index 00000000..c7cc2051
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/sideMenu/index.md
@@ -0,0 +1,3 @@
+---
+title: SideMenu
+---
diff --git a/doc/source/handycontrol/extend_controls/splitButton/index.md b/doc/source/handycontrol/extend_controls/splitButton/index.md
new file mode 100644
index 00000000..532fd314
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/splitButton/index.md
@@ -0,0 +1,3 @@
+---
+title: SplitButton
+---
diff --git a/doc/source/handycontrol/extend_controls/sprite/index.md b/doc/source/handycontrol/extend_controls/sprite/index.md
new file mode 100644
index 00000000..59360979
--- /dev/null
+++ b/doc/source/handycontrol/extend_controls/sprite/index.md
@@ -0,0 +1,3 @@
+---
+title: Sprite
+---
diff --git a/doc/source/handycontrol/extend_controls/timePicker/index.md b/doc/source/handycontrol/extend_controls/timePicker/index.md
index ca12ad62..5c65e872 100644
--- a/doc/source/handycontrol/extend_controls/timePicker/index.md
+++ b/doc/source/handycontrol/extend_controls/timePicker/index.md
@@ -1,5 +1,95 @@
---
-title: 建设中
+title: TimePicker
---
-建设中
\ No newline at end of file
+TimePicker 控件允许用户通过在文本框中键入时间或使用下拉的日历控件来选择时间。
+
+``` CS
+[TemplatePart(Name = ElementRoot, Type = typeof(Grid))]
+[TemplatePart(Name = ElementTextBox, Type = typeof(WatermarkTextBox))]
+[TemplatePart(Name = ElementButton, Type = typeof(Button))]
+[TemplatePart(Name = ElementPopup, Type = typeof(Popup))]
+public class TimePicker : Control, IDataInput
+```
+
+# 创建TimePicker
+
+``` XML
+
+```
+
+``` CS
+var timePicker = new TimePicker();
+```
+
+生成的TimePicker如下图所示:
+
+
+
+
+
+# 选择时间
+
+可以通过文本框输入时间,或者点击文本框右边的按钮打开下拉的时钟控件选择时间。
+
+
+
+也可以在XAML钟或代码中这样设置日期。
+
+``` XML
+
+```
+
+``` CS
+timePicker.SelectedTime = DateTime.Now;
+```
+
+# 更改时钟样式
+
+通过更改Clock属性,TimePicker可以更改时钟的样式。
+
+``` XML
+
+
+
+
+
+```
+
+
+
+# 设置标题和占位符文本
+
+你可以将 Header(标题)和 Placeholder(占位符)添加到DatePicker,以向用户指示其用途。要使用这两个属性,首先需要应用 **TimePickerExtend** 或 **TimePickerPlus** 样式。
+
+``` XML
+
+```
+
+
+
+
+# 属性
+
+| 属性 | 描述 |
+| ---------------- | ------------------ |
+| SelectedTime | 获取或设置当前选中的时间 |
+| Clock | 获取或设置下拉时钟 |
+| TimeFormat | 获取或设置用于显示选定的时间的格式 |
+| DisplayTime | 获取或设置要显示的时间 |
+| IsDropDownOpen | 获取或设置一个值,该值指示是打开还是关闭下拉时钟 |
+| Text | 获取由 **TimePicker** 显示的文本,或设置选定的时间 |
+| VerifyFunc | 获取或设置数据验证委托 |
+| IsError | 获取或设置数据是否错误 |
+| ErrorStr | 获取或设置错误提示 |
+| TextType | 获取或设置文本类型 |
+| ShowClearButton | 获取或设置是否显示清除按钮 |
+
+# 方法
+
+| 方法 | 描述 |
+| ---------------- | ------------------ |
+| VerifyData() | 验证数据 |
+
diff --git a/doc/source/handycontrol/images/Build_Config.png b/doc/source/handycontrol/images/Build_Config.png
deleted file mode 100644
index 8568462f..00000000
Binary files a/doc/source/handycontrol/images/Build_Config.png and /dev/null differ
diff --git a/doc/source/handycontrol/images/Net_GE45_Structure.png b/doc/source/handycontrol/images/Net_GE45_Structure.png
deleted file mode 100644
index 86c385a6..00000000
Binary files a/doc/source/handycontrol/images/Net_GE45_Structure.png and /dev/null differ
diff --git a/doc/source/handycontrol/images/Project_Structure.png b/doc/source/handycontrol/images/Project_Structure.png
deleted file mode 100644
index e7a9f4ed..00000000
Binary files a/doc/source/handycontrol/images/Project_Structure.png and /dev/null differ
diff --git a/doc/source/handycontrol/images/Sub_Folder_Structure.png b/doc/source/handycontrol/images/Sub_Folder_Structure.png
deleted file mode 100644
index 29f49557..00000000
Binary files a/doc/source/handycontrol/images/Sub_Folder_Structure.png and /dev/null differ
diff --git a/doc/source/handycontrol/index.md b/doc/source/handycontrol/index.md
index 407206a8..a4da7377 100644
--- a/doc/source/handycontrol/index.md
+++ b/doc/source/handycontrol/index.md
@@ -2,17 +2,11 @@
title: 欢迎使用HandyControl
---
-HandyControl是一套WPF控件库,它几乎重写了所有原生样式,同时包含50多款额外的控件(正逐步增加)。
+HandyControl是一套WPF控件库,它几乎重写了所有原生样式,同时包含70余款自定义控件(正逐步增加)。
# 要求
-- 使用要求
-.Net >= 4.0
-OS >= win7
-
-- 编译要求
-IDE >= vs2019
-C# >= 7.3
+   
# 下载
@@ -39,7 +33,7 @@ Github上一般每天都有更新,相对而言不适合用于生产。
## 整体结构
从Github上克隆好源码后,进入src文件夹,该文件夹结构如下:
-
+
这里一共有4个解决方案sln文件。
@@ -48,14 +42,14 @@ Github上一般每天都有更新,相对而言不适合用于生产。
`Shared`文件夹用于存放共享项目的代码
图中五个文件夹内部各包含两个子文件夹,例如在Shared中还包含两个子文件夹:
-
+
它们分别存放控件源码和控件示例源码。
## 源码结构
-我们以HandyControl_Net_GE45.sln为示例进行说明,使用VS2017打开该解决方案:
-
+我们以HandyControl.sln为示例进行说明,使用VS2019打开该解决方案:
+
如果要启动示例,查看控件效果,请将HandyControlDemo_[指定的项目类型]作为启动项。
@@ -82,10 +76,8 @@ Controls中的每个控件一般都能在Themes中找到对应的xaml定义。
# 编译源码
{% note warning %}
-编译前请确认你的开发环境是否符合使用要求。
+编译前请确认你的开发环境是否符合要求。
{% endnote %}
-{% note info %}
打开HandyControl.sln,在解决方案配置下拉框中选择指定的环境进行编译:
-
-{% endnote %}
\ No newline at end of file
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/langs/images/Langs.png b/doc/source/handycontrol/langs/images/Langs.png
deleted file mode 100644
index cfec814b..00000000
Binary files a/doc/source/handycontrol/langs/images/Langs.png and /dev/null differ
diff --git a/doc/source/handycontrol/langs/index.md b/doc/source/handycontrol/langs/index.md
index 567e3917..b3442cff 100644
--- a/doc/source/handycontrol/langs/index.md
+++ b/doc/source/handycontrol/langs/index.md
@@ -4,7 +4,7 @@ title: 国际化
# 使用方式
-可通过`ConfigHelper.Instance.SetLang(string lang)`指定需要使用的语言包,默认使用zh-cn。
+可通过`ConfigHelper.Instance.SetLang(string lang)`指定需要使用的语言包,默认使用简体中文(zh-cn)。
控件库自带的语言包一般为控件库内部使用,但用户也可以通过以下两种方式使用:
@@ -21,9 +21,15 @@ title: 国际化
# 扩展
-控件库自带zh-cn和en两份语言包,默认为zh-cn:
+控件库自带的语言包包括:
-
+* 简体中文(zh-cn)
+* 英文(en)
+* 波斯语(fa)
+* 法语(fr)
+* 韩文 (ko-kr)
+
+默认为简体中文(zh-cn)。
如果需要可自行扩展,这里推荐使用开源插件:[ResXManager](https://marketplace.visualstudio.com/items?itemName=TomEnglert.ResXManager),来维护所有的语言包。
diff --git a/doc/source/handycontrol/native_controls/border/index.md b/doc/source/handycontrol/native_controls/border/index.md
index 63da2560..e3551636 100644
--- a/doc/source/handycontrol/native_controls/border/index.md
+++ b/doc/source/handycontrol/native_controls/border/index.md
@@ -6,38 +6,38 @@ title: Border 边框
此样式用于包裹一个控件区域,配合基础xaml定义中的几个DropShadowEffect资源可制作如下效果:
-
+
以上效果的xaml代码如下:
``` xml
-
+
-
+
-
+
-
+
-
+
-
+
@@ -45,6 +45,8 @@ title: Border 边框
```
+提示:新版本中使用的`BorderRegion`,有别于老版本使用样式`BorderRegionStyle`,由直角变更为圆角
+
# BorderVerticallySplitter
此样式使用1单位宽度的Border来分割横向排列的控件。
@@ -65,7 +67,7 @@ title: Border 边框
{% endcode %}
-
+
{% endnote %}
# BorderHorizontallySplitter
@@ -88,7 +90,7 @@ title: Border 边框
{% endcode %}
-
+
{% endnote %}
# BorderCircular
@@ -101,7 +103,7 @@ title: Border 边框
{% code %}
{% endcode %}
-
+
{% endnote %}
# BorderClip
@@ -116,5 +118,5 @@ title: Border 边框
{% endcode %}
-
+
{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/button/index.md b/doc/source/handycontrol/native_controls/button/index.md
index 4a82fbe8..3c0deb6c 100644
--- a/doc/source/handycontrol/native_controls/button/index.md
+++ b/doc/source/handycontrol/native_controls/button/index.md
@@ -24,7 +24,7 @@ title: Button 按钮
{% endcode %}
-
+
{% endnote %}
# ButtonPrimary : ButtonBaseStyle
@@ -41,7 +41,7 @@ title: Button 按钮
{% endcode %}
-
+
{% endnote %}
# ButtonSuccess : ButtonBaseStyle
@@ -58,7 +58,7 @@ title: Button 按钮
{% endcode %}
-
+
{% endnote %}
# ButtonInfo : ButtonBaseStyle
@@ -75,7 +75,7 @@ title: Button 按钮
{% endcode %}
-
+
{% endnote %}
# ButtonWarning : ButtonBaseStyle
@@ -92,7 +92,7 @@ title: Button 按钮
{% endcode %}
-
+
{% endnote %}
# ButtonDanger : ButtonBaseStyle
@@ -109,7 +109,7 @@ title: Button 按钮
{% endcode %}
-
+
{% endnote %}
# ButtonIcon : ButtonBaseStyle
@@ -126,7 +126,7 @@ title: Button 按钮
{% endcode %}
-
+
{% endnote %}
# ButtonCustom
@@ -139,5 +139,5 @@ title: Button 按钮
{% code %}
{% endcode %}
-
+
{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/calendar/index.md b/doc/source/handycontrol/native_controls/calendar/index.md
index 6f7f0482..1ffb9210 100644
--- a/doc/source/handycontrol/native_controls/calendar/index.md
+++ b/doc/source/handycontrol/native_controls/calendar/index.md
@@ -12,5 +12,5 @@ title: Calendar 日历
{% code %}
{% endcode %}
-
+
{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/checkBox/index.md b/doc/source/handycontrol/native_controls/checkBox/index.md
index 4218e941..1ad33b14 100644
--- a/doc/source/handycontrol/native_controls/checkBox/index.md
+++ b/doc/source/handycontrol/native_controls/checkBox/index.md
@@ -19,5 +19,5 @@ title: CheckBox 复选框
{% endcode %}
-
+
{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/comboBox/index.md b/doc/source/handycontrol/native_controls/comboBox/index.md
index 635b0a84..b451f642 100644
--- a/doc/source/handycontrol/native_controls/comboBox/index.md
+++ b/doc/source/handycontrol/native_controls/comboBox/index.md
@@ -8,7 +8,7 @@ title: ComboBox 组合框
- 默认样式
``
-
+
# ComboBoxExtendBaseStyle : ComboBoxBaseStyle
@@ -20,11 +20,11 @@ title: ComboBox 组合框
- 标题在上
``
-
+
- 标题在左
``
-
+
{% note warning %}
标题在左时,为了多个输入框左侧对齐,需要设置标题宽度,标题宽度无需逐个设置,可在外部容器上统一设置。
@@ -32,18 +32,18 @@ title: ComboBox 组合框
{% note warning %}
常见问题:
Combobox的字体比原有默认字体大,同时设定标题在左,标题因字体过大显示不全
-
+
解决方案:
-在该Combobox中添加附加属性`hc:InfoElement.ContentHeight`,默认值为30,默认字体号为12,变更后可根据新的字体大小设定该附加属性的数值,如上图,字体大小为18,则设定`hc:InfoElement.ContentHeight`为38,结果如下:
+在该Combobox中添加附加属性`hc:InfoElement.ContentHeight`,默认值为30,默认字体号为12,变更后可根据新的字体大小设定该附加属性的数值,如上图,字体大小为18,则设定`hc:InfoElement.ContentHeight`为38,结果如下:
{% endnote %}
- 标题在上,带有水印
``
-
+
- 标题在上,带有水印,且为必填
``
-
+
- 标题在上,带有水印,且为必填,同时自定义必填提示符
``
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/contextMenu/index.md b/doc/source/handycontrol/native_controls/contextMenu/index.md
index fdcf837e..0c78954a 100644
--- a/doc/source/handycontrol/native_controls/contextMenu/index.md
+++ b/doc/source/handycontrol/native_controls/contextMenu/index.md
@@ -18,5 +18,5 @@ title: ContextMenu 上下文菜单
{% endcode %}
-
+
{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/dataGrid/index.md b/doc/source/handycontrol/native_controls/dataGrid/index.md
index 7ea36f18..f57830b0 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 %}
用例:
@@ -28,5 +41,36 @@ 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/datePicker/index.md b/doc/source/handycontrol/native_controls/datePicker/index.md
index d4f5933e..330ab73a 100644
--- a/doc/source/handycontrol/native_controls/datePicker/index.md
+++ b/doc/source/handycontrol/native_controls/datePicker/index.md
@@ -8,7 +8,7 @@ title: DatePicker 日期选择器
- 默认样式
``
-
+
# DatePickerExtendBaseStyle : DatePickerBaseStyle
@@ -18,21 +18,21 @@ title: DatePicker 日期选择器
- 标题在上
``
-
+
- 标题在左
``
-
+
{% note warning %}
标题在左时,为了多个输入框左侧对齐,需要设置标题宽度,标题宽度无需逐个设置,可在外部容器上统一设置。
{% endnote %}
- 标题在上,带有水印
-[参见Combobox](../combobox)
+[参见Combobox](https://handyorg.github.io/handycontrol/native_controls/comboBox/)
- 标题在上,带有水印,且为必填
-[参见Combobox](../combobox)
+[参见Combobox](https://handyorg.github.io/handycontrol/native_controls/comboBox/)
- 标题在上,带有水印,且为必填,同时自定义必填提示符
-[参见Combobox](../combobox)
\ No newline at end of file
+[参见Combobox](https://handyorg.github.io/handycontrol/native_controls/comboBox/)
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/expander/index.md b/doc/source/handycontrol/native_controls/expander/index.md
index ca12ad62..094e9c99 100644
--- a/doc/source/handycontrol/native_controls/expander/index.md
+++ b/doc/source/handycontrol/native_controls/expander/index.md
@@ -1,5 +1,30 @@
---
-title: 建设中
+title: Expander 展开框
---
-建设中
\ No newline at end of file
+# ExpanderBaseStyle
+
+Expander 展开框 默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endcode %}
+
+
+
+{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/flowDocument/index.md b/doc/source/handycontrol/native_controls/flowDocument/index.md
new file mode 100644
index 00000000..24ea90d6
--- /dev/null
+++ b/doc/source/handycontrol/native_controls/flowDocument/index.md
@@ -0,0 +1,117 @@
+---
+title: FlowDocument 流文档
+---
+
+# FlowDocumentScrollViewerBaseStyle
+
+流文档滚动视图默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+案例:
+
+``` xml
+
+
+
+
+ Neptune (planet), major planet in the solar system, eighth planet
+ from the Sun and fourth largest in diameter. Neptune maintains an almost constant
+ distance, about 4,490 million km (about 2,790 million mi), from the Sun. Neptune
+ revolves outside the orbit of Uranus and for most of its orbit moves inside the
+ elliptical path of the outermost planet Pluto (see Solar System). Every 248 years,
+ Pluto’s elliptical orbit brings the planet inside Neptune’s nearly circular orbit
+ for about 20 years, temporarily making Neptune the farthest planet from the Sun.
+ The last time Pluto’s orbit brought it inside Neptune’s orbit was in 1979. In
+ 1999 Pluto’s orbit carried it back outside Neptune’s orbit.
+
+
+ Neptune has 72 times Earth's volume...
+
+
+
+
+
+
+
+
+
+
+
+ Neptune Stats
+
+
+
+
+ Mean Distance from Sun
+
+
+ 4,504,000,000 km
+
+
+
+
+ Mean Diameter
+
+
+ 49,532 km
+
+
+
+
+ Approximate Mass
+
+
+ 1.0247e26 kg
+
+
+
+
+
+ Information from the
+ Encarta
+ web site.
+
+
+
+
+
+
+
+
+ Astronomers believe Neptune has an inner rocky core that is surrounded by a vast
+ ocean of water mixed with rocky material. From the inner core, this ocean extends
+ upward until it meets a gaseous atmosphere of hydrogen, helium, and trace amounts
+ of methane. Neptune has four rings and 11 known moons. Even though Neptune's volume
+ is 72 times Earth’s volume, its mass is only 17.15 times Earth’s mass. Because of
+ its size, scientists classify Neptune—along with Jupiter, Saturn, and Uranus—as
+ one of the giant or Jovian planets (so-called because they resemble Jupiter).
+
+
+
+
+ Neptune has an orbital period of ~20 years...
+
+
+ Mathematical theories of astronomy led to the discovery of Neptune. To account for
+ wobbles in the orbit of the planet Uranus, British astronomer John Couch Adams and
+ French astronomer Urbain Jean Joseph Leverrier independently calculated the existence
+ and position of a new planet in 1845 and 1846, respectively. They theorized that the
+ gravitational attraction of this planet for Uranus was causing the wobbles in Uranus’s
+ orbit. Using information from Leverrier, German astronomer Johann Gottfried Galle first
+ observed the planet in 1846.
+
+
+
+
+```
+
+效果:
+
+
+
+# FlowDocumentPageViewerBaseStyle
+
+流文档单页视图默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+# FlowDocumentReaderBaseStyle
+
+流文档查看器默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/frame/index.md b/doc/source/handycontrol/native_controls/frame/index.md
new file mode 100644
index 00000000..b78c4faa
--- /dev/null
+++ b/doc/source/handycontrol/native_controls/frame/index.md
@@ -0,0 +1,17 @@
+---
+title: Frame 导航框架
+---
+
+# FrameBaseStyle
+
+导航框架默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+案例:
+
+``` xml
+
+```
+
+效果:
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/groupBox/index.md b/doc/source/handycontrol/native_controls/groupBox/index.md
index ca12ad62..4a83ce35 100644
--- a/doc/source/handycontrol/native_controls/groupBox/index.md
+++ b/doc/source/handycontrol/native_controls/groupBox/index.md
@@ -1,5 +1,84 @@
---
-title: 建设中
+title: GroupBox 分组框
---
-建设中
\ No newline at end of file
+# GroupBoxBaseStyle
+
+GroupBox 分组框 默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+
+
+
+
+{% endcode %}
+
+{% endnote %}
+
+这里提供另外一种样式,供开发者选择
+
+{% note info no-icon %}
+只需要添加扩展属性即可
+{% code %}
+hc:TitleElement.TitleAlignment="Left"
+{% endcode %}
+用例:
+{% code %}
+
+
+
+
+
+{% endcode %}
+
+
+{% endnote %}
+
+# GroupBoxTab : GroupBoxTabBaseStyle : GroupBoxBaseStyle
+
+GroupBox 分组框 的另一种样式 GroupBoxTabBaseStyle 不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+
+
+
+
+{% endcode %}
+
+- 同样可以 使用扩展属性 {% code %} hc:TitleElement.TitleAlignment="Left" {% endcode %}
+
+ 
+{% endnote %}
+
+# GroupBoxOriginal : GroupBoxOriginalBaseStyle : GroupBoxBaseStyle
+
+GroupBox 分组框 的另一种样式 GroupBoxOriginalBaseStyle 不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+
+
+
+
+
+{% endcode %}
+
+ 
+{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/image/index.md b/doc/source/handycontrol/native_controls/image/index.md
index ca12ad62..85764b53 100644
--- a/doc/source/handycontrol/native_controls/image/index.md
+++ b/doc/source/handycontrol/native_controls/image/index.md
@@ -1,5 +1,18 @@
---
-title: 建设中
+title: Image图片
---
-建设中
\ No newline at end of file
+在`HandyControl`中,对应原生的`Image`控件,仅仅提供了一个默认的控件样式,并未提供特殊样式,对于个性化定制,需要使用者自行定制。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+
+
+
+{% endcode %}
+
+
+
+{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/images/BorderCircular_1.png b/doc/source/handycontrol/native_controls/images/BorderCircular_1.png
deleted file mode 100644
index 9cc0f769..00000000
Binary files a/doc/source/handycontrol/native_controls/images/BorderCircular_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/BorderClip_1.png b/doc/source/handycontrol/native_controls/images/BorderClip_1.png
deleted file mode 100644
index b52e9ff0..00000000
Binary files a/doc/source/handycontrol/native_controls/images/BorderClip_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/BorderHorizontallySplitter_1.png b/doc/source/handycontrol/native_controls/images/BorderHorizontallySplitter_1.png
deleted file mode 100644
index 4ef9dee9..00000000
Binary files a/doc/source/handycontrol/native_controls/images/BorderHorizontallySplitter_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/BorderVerticallySplitter_1.png b/doc/source/handycontrol/native_controls/images/BorderVerticallySplitter_1.png
deleted file mode 100644
index 2555e3c8..00000000
Binary files a/doc/source/handycontrol/native_controls/images/BorderVerticallySplitter_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ButtonBaseStyle_1.png b/doc/source/handycontrol/native_controls/images/ButtonBaseStyle_1.png
deleted file mode 100644
index 40586f1f..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ButtonBaseStyle_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ButtonCustom_1.gif b/doc/source/handycontrol/native_controls/images/ButtonCustom_1.gif
deleted file mode 100644
index e53ed520..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ButtonCustom_1.gif and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ButtonDanger_1.png b/doc/source/handycontrol/native_controls/images/ButtonDanger_1.png
deleted file mode 100644
index f9d9fb8b..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ButtonDanger_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ButtonIcon_1.png b/doc/source/handycontrol/native_controls/images/ButtonIcon_1.png
deleted file mode 100644
index 64252ba5..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ButtonIcon_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ButtonInfo_1.png b/doc/source/handycontrol/native_controls/images/ButtonInfo_1.png
deleted file mode 100644
index ad97bc60..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ButtonInfo_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ButtonPrimary_1.png b/doc/source/handycontrol/native_controls/images/ButtonPrimary_1.png
deleted file mode 100644
index 4cd60092..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ButtonPrimary_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ButtonSuccess_1.png b/doc/source/handycontrol/native_controls/images/ButtonSuccess_1.png
deleted file mode 100644
index 076bd8b7..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ButtonSuccess_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ButtonWarning_1.png b/doc/source/handycontrol/native_controls/images/ButtonWarning_1.png
deleted file mode 100644
index d33e2980..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ButtonWarning_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ComboBoxBaseStyle.png b/doc/source/handycontrol/native_controls/images/ComboBoxBaseStyle.png
deleted file mode 100644
index 84e4da34..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ComboBoxBaseStyle.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_1.png b/doc/source/handycontrol/native_controls/images/ComboBoxExtend_1.png
deleted file mode 100644
index 31195a92..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_2.png b/doc/source/handycontrol/native_controls/images/ComboBoxExtend_2.png
deleted file mode 100644
index a2b8060c..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_2.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_2_Error1.png b/doc/source/handycontrol/native_controls/images/ComboBoxExtend_2_Error1.png
deleted file mode 100644
index c824361f..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_2_Error1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_2_Ok1.png b/doc/source/handycontrol/native_controls/images/ComboBoxExtend_2_Ok1.png
deleted file mode 100644
index 3711d140..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_2_Ok1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_3.png b/doc/source/handycontrol/native_controls/images/ComboBoxExtend_3.png
deleted file mode 100644
index 56a4ef35..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_3.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_4.png b/doc/source/handycontrol/native_controls/images/ComboBoxExtend_4.png
deleted file mode 100644
index 9287b33d..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_4.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_5.png b/doc/source/handycontrol/native_controls/images/ComboBoxExtend_5.png
deleted file mode 100644
index 761325f3..00000000
Binary files a/doc/source/handycontrol/native_controls/images/ComboBoxExtend_5.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/DatePickerBaseStyle.png b/doc/source/handycontrol/native_controls/images/DatePickerBaseStyle.png
deleted file mode 100644
index ddc505b1..00000000
Binary files a/doc/source/handycontrol/native_controls/images/DatePickerBaseStyle.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/DatePickerExtend_1.png b/doc/source/handycontrol/native_controls/images/DatePickerExtend_1.png
deleted file mode 100644
index 489f613f..00000000
Binary files a/doc/source/handycontrol/native_controls/images/DatePickerExtend_1.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/images/DatePickerExtend_2.png b/doc/source/handycontrol/native_controls/images/DatePickerExtend_2.png
deleted file mode 100644
index 2f350a68..00000000
Binary files a/doc/source/handycontrol/native_controls/images/DatePickerExtend_2.png and /dev/null differ
diff --git a/doc/source/handycontrol/native_controls/label/index.md b/doc/source/handycontrol/native_controls/label/index.md
index ca12ad62..cbd200ed 100644
--- a/doc/source/handycontrol/native_controls/label/index.md
+++ b/doc/source/handycontrol/native_controls/label/index.md
@@ -1,5 +1,87 @@
---
-title: 建设中
+title: Lable标签
---
-建设中
\ No newline at end of file
+# LabelBaseStyle
+
+Label标签默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+{% endcode %}
+
+
+
+{% endnote %}
+
+# LabelPrimary : LabelBaseStyle
+
+主样式
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+{% endcode %}
+
+
+
+{% endnote %}
+
+# LabelSuccess : LabelBaseStyle
+
+成功类型样式
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+{% endcode %}
+
+
+
+{% endnote %}
+
+# LabelInfo : LabelBaseStyle
+
+信息类型样式
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+{% endcode %}
+
+
+
+{% endnote %}
+
+# LabelWarning : LabelBaseStyle
+
+警告类型样式
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+{% endcode %}
+
+
+
+{% endnote %}
+
+# LabelDanger : LabelBaseStyle
+
+危险类型样式
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+{% endcode %}
+
+
+
+{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/listBox/index.md b/doc/source/handycontrol/native_controls/listBox/index.md
index ca12ad62..29de370d 100644
--- a/doc/source/handycontrol/native_controls/listBox/index.md
+++ b/doc/source/handycontrol/native_controls/listBox/index.md
@@ -1,5 +1,147 @@
---
-title: 建设中
+title: ListBox 列表框
---
-建设中
\ No newline at end of file
+# ListBoxBaseStyle
+
+ ListBox默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+{% endcode %}
+
+
+
+{% endnote %}
+
+# ListBoxCustom : ListBoxBaseStyle
+
+ListBox列表Custom样式,该样式保留了Listbox的基本属性样式,而数据显示样式由当前用户自定义,实现个性化定制。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+
+
+
+
+
+
+
+
+
+
+
+{% endcode %}
+
+
+
+{% endnote %}
+
+# WrapPanelHorizontalListBox : ListBoxCustom
+
+布局容器为WrapPanel,水平方向显示样式。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+
+
+
+
+
+
+
+
+
+
+
+{% endcode %}
+
+
+
+{% endnote %}
+
+# WrapPanelVerticalListBox : ListBoxCustom
+
+布局容器为WrapPanel,垂直方向显示样式。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+
+
+
+
+
+
+
+
+
+
+
+{% endcode %}
+
+
+
+{% endnote %}
+
+# StackPanelHorizontalListBox : ListBoxCustom
+
+布局容器为StackPanel,水平方向显示样式。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+
+
+
+
+
+
+
+
+
+
+
+{% endcode %}
+
+
+
+{% endnote %}
+
+# StackPanelVerticalListBox : ListBoxCustom
+
+布局容器为StackPanel,垂直方向显示样式。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+
+
+
+
+
+
+
+
+
+
+
+{% endcode %}
+
+
+
+{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/listView/index.md b/doc/source/handycontrol/native_controls/listView/index.md
index ca12ad62..10c9d1cb 100644
--- a/doc/source/handycontrol/native_controls/listView/index.md
+++ b/doc/source/handycontrol/native_controls/listView/index.md
@@ -1,5 +1,23 @@
---
-title: 建设中
+title: ListView 列表视图
---
-建设中
\ No newline at end of file
+`HandyControl`中仅提供了一个默认的`ListView`样式,可根据个人需求,自行定义。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+
+
+
+
+
+
+
+
+{% endcode %}
+
+
+
+{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/menu/index.md b/doc/source/handycontrol/native_controls/menu/index.md
index ca12ad62..28d0237f 100644
--- a/doc/source/handycontrol/native_controls/menu/index.md
+++ b/doc/source/handycontrol/native_controls/menu/index.md
@@ -1,5 +1,23 @@
---
-title: 建设中
+title: Menu 菜单
---
-建设中
\ No newline at end of file
+# MenuBaseStyle
+
+菜单默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+{% endcode %}
+
+
+
+{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/passwordBox/index.md b/doc/source/handycontrol/native_controls/passwordBox/index.md
index ca12ad62..0b72a68d 100644
--- a/doc/source/handycontrol/native_controls/passwordBox/index.md
+++ b/doc/source/handycontrol/native_controls/passwordBox/index.md
@@ -1,5 +1,45 @@
---
-title: 建设中
+title: PasswordBox 密码框
---
-建设中
\ No newline at end of file
+# PasswordBoxBaseStyle
+
+原生密码框默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+{% endcode %}
+
+
+
+{% endnote %}
+
+# PasswordBoxExtendBaseStyle : PasswordBoxBaseStyle
+
+原生密码框扩展默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+# PasswordBoxExtend : PasswordBoxExtendBaseStyle
+
+相对于原生密码框默认样式,它借助于附加属性可以实现标题、水印的功能。
+
+{% note info no-icon %}
+用例:
+{% code %}
+
+
+
+{% endcode %}
+
+
+
+{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/progressBar/index.md b/doc/source/handycontrol/native_controls/progressBar/index.md
index ca12ad62..8f5ca2a7 100644
--- a/doc/source/handycontrol/native_controls/progressBar/index.md
+++ b/doc/source/handycontrol/native_controls/progressBar/index.md
@@ -1,5 +1,79 @@
---
-title: 建设中
+title: ProgressBar 进度条
---
-建设中
\ No newline at end of file
+# ProgressBarBaseStyle
+
+进度条默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+# 其他样式
+
+`HandyControl`中自带的其他样式和效果,其中包含如下样式:
+
+| 样式Key | 用途 |父样式|
+| ------------------ | ---- ||
+| ProgressBarSuccess | 成功色进度条 |ProgressBarBaseStyle|
+| ProgressBarInfo | 提示色进度条 |ProgressBarBaseStyle|
+| ProgressBarWarning | 警告色进度条 |ProgressBarBaseStyle|
+| ProgressBarDanger | 危险色进度条 |ProgressBarBaseStyle|
+| ProgressBarStripeBaseStyle | 条纹进度条默认样式(不推荐直接使用) |-|
+| ProgressBarPrimaryStripe | 主题色条纹进度条 |ProgressBarStripeBaseStyle|
+| ProgressBarSuccessStripe | 成功色条纹进度条 |ProgressBarStripeBaseStyle|
+| ProgressBarInfoStripe | 信息色条纹进度条 |ProgressBarStripeBaseStyle|
+| ProgressBarWarningStripe | 警告色条纹进度条 |ProgressBarStripeBaseStyle|
+| ProgressBarDangerStripe | 危险色条纹进度条 |ProgressBarStripeBaseStyle|
+| ProgressBarFlat | 扁平风格 |-|
+
+案例:
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+效果:
+
+
+# 温馨提示
+
+对于颜色、圆角或其它自定义需求,可参考[进度条样式源码](https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControl_Shared/Themes/Styles/ProgressBar.xaml)自行定义。
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/radioButton/index.md b/doc/source/handycontrol/native_controls/radioButton/index.md
index ca12ad62..9e95e83d 100644
--- a/doc/source/handycontrol/native_controls/radioButton/index.md
+++ b/doc/source/handycontrol/native_controls/radioButton/index.md
@@ -1,5 +1,41 @@
---
-title: 建设中
+title: RadioButton 单选按钮
---
-建设中
\ No newline at end of file
+# RadioButtonBaseStyle
+
+单选按钮默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+案例:
+
+```xml
+
+
+
+
+
+
+```
+
+效果:
+
+
+
+# RadioButtonIcon : RadioButtonBaseStyle
+
+带图标样式,可只显示图标也可图文显示
+
+案例:
+
+```xml
+
+
+
+
+
+
+```
+
+效果:
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/richTextBox/index.md b/doc/source/handycontrol/native_controls/richTextBox/index.md
index ca12ad62..3e33e5e1 100644
--- a/doc/source/handycontrol/native_controls/richTextBox/index.md
+++ b/doc/source/handycontrol/native_controls/richTextBox/index.md
@@ -1,5 +1,21 @@
---
-title: 建设中
+title: RichTextBox 富文本框
---
-建设中
\ No newline at end of file
+# TextBoxBaseBaseStyle
+
+基础文本控件默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+# RichTextBoxBaseStyle : TextBoxBaseBaseStyle
+
+富文本框默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+案例:
+
+```xml
+
+```
+
+效果:
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/scrollViewer/index.md b/doc/source/handycontrol/native_controls/scrollViewer/index.md
index ca12ad62..8d39838d 100644
--- a/doc/source/handycontrol/native_controls/scrollViewer/index.md
+++ b/doc/source/handycontrol/native_controls/scrollViewer/index.md
@@ -1,5 +1,42 @@
---
-title: 建设中
+title: ScrollViewer 滚动视图
---
-建设中
\ No newline at end of file
+# ScrollViewerNativeBaseStyle
+
+原生滚动视图默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+案例:
+
+```xml
+
+
+
+
+
+```
+
+效果:
+
+
+
+# ScrollViewerUpDown
+
+显示上下按钮的滚动视图样式
+
+案例:
+
+```xml
+
+
+
+
+
+
+
+
+```
+
+效果:
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/seperator/index.md b/doc/source/handycontrol/native_controls/seperator/index.md
new file mode 100644
index 00000000..9b06017b
--- /dev/null
+++ b/doc/source/handycontrol/native_controls/seperator/index.md
@@ -0,0 +1,7 @@
+---
+title: Seperator 分隔符
+---
+
+# SeparatorBaseStyle
+
+分隔符默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/slider/index.md b/doc/source/handycontrol/native_controls/slider/index.md
index ca12ad62..3ffd997e 100644
--- a/doc/source/handycontrol/native_controls/slider/index.md
+++ b/doc/source/handycontrol/native_controls/slider/index.md
@@ -1,5 +1,17 @@
---
-title: 建设中
+title: Slider 滑块
---
-建设中
\ No newline at end of file
+# SliderBaseStyle
+
+滑块默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+案例:
+
+```xml
+
+```
+
+效果:
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/statusBar/index.md b/doc/source/handycontrol/native_controls/statusBar/index.md
new file mode 100644
index 00000000..6fe4aa99
--- /dev/null
+++ b/doc/source/handycontrol/native_controls/statusBar/index.md
@@ -0,0 +1,7 @@
+---
+title: StatusBar 状态栏
+---
+
+# StatusBarBaseStyle
+
+状态栏默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/tabControl/index.md b/doc/source/handycontrol/native_controls/tabControl/index.md
index ca12ad62..1c2ac558 100644
--- a/doc/source/handycontrol/native_controls/tabControl/index.md
+++ b/doc/source/handycontrol/native_controls/tabControl/index.md
@@ -1,5 +1,93 @@
---
-title: 建设中
+title: TabControl 选项卡控件
---
-建设中
\ No newline at end of file
+# TabControlBaseStyle
+
+选项卡控件默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+案例:
+
+ ```xml
+
+
+
+
+
+
+
+
+ ```
+
+效果:
+
+
+
+# TabControlInLine : TabControlBaseStyle
+
+单行填充选项卡样式
+
+案例:
+
+```xml
+
+
+
+
+
+
+
+
+```
+
+效果:
+
+
+
+# TabControlCapsule
+
+胶囊状选项卡样式
+
+案例:
+
+```xml
+
+
+
+
+
+
+
+
+```
+
+效果:
+
+
+
+# TabControlCapsuleSolid : TabControlCapsule
+
+胶囊状(实心)选项卡样式
+
+案例:
+
+```xml
+
+
+
+
+
+
+
+
+```
+
+效果:
+
+
+
+# 温馨提示
+
+可以使用属性`TabStripPlacement`设定头部标题的位置,效果如下:
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/textBlock/index.md b/doc/source/handycontrol/native_controls/textBlock/index.md
index ca12ad62..b1baf500 100644
--- a/doc/source/handycontrol/native_controls/textBlock/index.md
+++ b/doc/source/handycontrol/native_controls/textBlock/index.md
@@ -1,5 +1,37 @@
---
-title: 建设中
+title: TextBlock 文本块
---
-建设中
\ No newline at end of file
+# TextBlockBaseStyle
+
+文本块默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+# TextBlockBoldBaseStyle
+
+文本块粗体默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+# 案例
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/textBox/index.md b/doc/source/handycontrol/native_controls/textBox/index.md
index ca12ad62..b9a3dcc8 100644
--- a/doc/source/handycontrol/native_controls/textBox/index.md
+++ b/doc/source/handycontrol/native_controls/textBox/index.md
@@ -1,5 +1,40 @@
---
-title: 建设中
+title: TextBox 文本框
---
-建设中
\ No newline at end of file
+# TextBoxBaseStyle
+
+原生文本框默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+- 默认样式
+``
+
+
+# TextBoxExtendBaseStyle : TextBoxBaseStyle
+
+原生文本框扩展默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+# TextBoxExtend : TextBoxExtendBaseStyle
+
+相对于原生文本框默认样式,它借助于附加属性可以实现标题、水印的功能。
+
+- 标题在上
+``
+
+
+- 标题在左
+``
+
+
+{% note warning %}
+标题在左时,为了多个输入框左侧对齐,需要设置标题宽度,标题宽度无需逐个设置,可在外部容器上统一设置。
+{% endnote %}
+
+- 标题在上,带有水印
+[参见Combobox](https://handyorg.github.io/handycontrol/native_controls/comboBox/)
+
+- 标题在上,带有水印,且为必填
+[参见Combobox](https://handyorg.github.io/handycontrol/native_controls/comboBox/)
+
+- 标题在上,带有水印,且为必填,同时自定义必填提示符
+[参见Combobox](https://handyorg.github.io/handycontrol/native_controls/comboBox/)
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/toggleButton/index.md b/doc/source/handycontrol/native_controls/toggleButton/index.md
index ca12ad62..94a04022 100644
--- a/doc/source/handycontrol/native_controls/toggleButton/index.md
+++ b/doc/source/handycontrol/native_controls/toggleButton/index.md
@@ -1,5 +1,177 @@
---
-title: 建设中
+title: ToggleButton 切换按钮
---
-建设中
\ No newline at end of file
+# ToggleButtonBaseStyle : ButtonBaseBaseStyle
+
+切换按钮默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+{% note info %}
+所有继承此样式的按钮都可以使用`IconElement`中定义的附加属性来控制按钮中几何图形的属性。
+{% endnote %}
+
+{% note info %}
+所有继承此样式的按钮都可以使用`BorderElement.CornerRadius`附加属性来控制按钮的圆角大小。
+{% endnote %}
+
+## 相关样式
+
+| 名称 | 继承自 | 用途描述 |
+| - | - | - |
+| ToggleButtonPrimary | ToggleButtonBaseStyle | 主要 |
+| ToggleButtonSuccess | ToggleButtonBaseStyle | 成功 |
+| ToggleButtonInfo | ToggleButtonBaseStyle | 信息 |
+| ToggleButtonWarning | ToggleButtonBaseStyle | 警告 |
+| ToggleButtonDanger | ToggleButtonBaseStyle | 危险 |
+
+案例:
+
+```xml
+
+
+
+
+
+
+
+
+```
+
+效果:
+
+
+
+# ToggleButtonIconBaseStyle : BaseStyle
+
+只显示图标的切换按钮,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+{% note info %}
+所有继承此样式的按钮都可以使用`IconElement`中定义的附加属性来控制按钮中几何图形的属性。
+{% endnote %}
+
+{% note info %}
+所有继承此样式的按钮都可以使用`BorderElement.CornerRadius`附加属性来控制按钮的圆角大小。
+{% endnote %}
+
+## 相关样式
+
+| 名称 | 继承自 | 用途描述 |
+| - | - | - |
+| ToggleButtonIcon | ToggleButtonIconBaseStyle | 默认 |
+| ToggleButtonIconPrimary | ToggleButtonIconBaseStyle | 主要 |
+| ToggleButtonIconSuccess | ToggleButtonIconBaseStyle | 成功 |
+| ToggleButtonIconInfo | ToggleButtonIconBaseStyle | 信息 |
+| ToggleButtonIconWarning | ToggleButtonIconBaseStyle | 警告 |
+| ToggleButtonIconDanger | ToggleButtonIconBaseStyle | 危险 |
+| ToggleButtonIconTransparent | ToggleButtonIconBaseStyle | 透明 |
+
+案例:
+
+```xml
+
+
+
+
+
+
+
+
+
+```
+
+效果:
+
+
+
+# ToggleButtonSwitchBaseStyle : BaseStyle
+
+开关式切换按钮,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+## 相关样式
+
+| 名称 | 继承自 |
+| - | - |
+| ToggleButtonSwitch | ToggleButtonSwitchBaseStyle |
+
+案例:
+
+```xml
+
+
+
+
+```
+
+效果:
+
+
+
+# ToggleButtonFlip : BaseStyle
+
+翻转式切换按钮。
+
+案例:
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+效果:
+
+
+
+# ToggleButtonCustom : BaseStyle
+
+如果想完全自定义按钮的内容,则推荐使用此样式。`ToggleButtonCustom`中的内容完全由你自己决定。
+
+案例:
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+效果:
+
+
diff --git a/doc/source/handycontrol/native_controls/toolBar/index.md b/doc/source/handycontrol/native_controls/toolBar/index.md
index ca12ad62..17b6d024 100644
--- a/doc/source/handycontrol/native_controls/toolBar/index.md
+++ b/doc/source/handycontrol/native_controls/toolBar/index.md
@@ -1,5 +1,21 @@
---
-title: 建设中
+title: ToolBar 工具条
---
-建设中
\ No newline at end of file
+# ToolBarBaseStyle
+
+工具条默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+案例:
+
+```xml
+
+
+
+
+
+```
+
+效果:
+
+
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/toolTip/index.md b/doc/source/handycontrol/native_controls/toolTip/index.md
index ca12ad62..57eb7c77 100644
--- a/doc/source/handycontrol/native_controls/toolTip/index.md
+++ b/doc/source/handycontrol/native_controls/toolTip/index.md
@@ -1,5 +1,7 @@
---
-title: 建设中
+title: ToolTip 工具提示
---
-建设中
\ No newline at end of file
+# ToolTipBaseStyle
+
+工具提示默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/treeView/index.md b/doc/source/handycontrol/native_controls/treeView/index.md
index ca12ad62..be3ad34f 100644
--- a/doc/source/handycontrol/native_controls/treeView/index.md
+++ b/doc/source/handycontrol/native_controls/treeView/index.md
@@ -1,5 +1,35 @@
---
-title: 建设中
+title: TreeView 树视图
---
-建设中
\ No newline at end of file
+# TreeViewBaseStyle : BaseStyle
+
+树视图默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
+
+案例:
+
+ ```xml
+
+
+
+
+
+
+
+
+
+
+
+
+ ```
+
+效果:
+
+
+
+# 相关样式
+
+| 名称 | 继承自 | 用途描述 |
+| - | - | - |
+| TreeViewItemBaseStyle | BaseStyle | 树视图项默认样式 |
+| ExpandCollapseToggleStyle | | 树视图折叠按钮样式 |
\ No newline at end of file
diff --git a/doc/source/handycontrol/native_controls/window/index.md b/doc/source/handycontrol/native_controls/window/index.md
index ca12ad62..e5275a54 100644
--- a/doc/source/handycontrol/native_controls/window/index.md
+++ b/doc/source/handycontrol/native_controls/window/index.md
@@ -1,5 +1,13 @@
---
-title: 建设中
+title: Window 窗口
---
-建设中
\ No newline at end of file
+`wpf`中窗口不会自动应用隐式样式,`hc`中提供了相关方法用以解决这个问题。
+
+# Window 窗口
+
+可通过 `ConfigHelper.Instance.SetWindowDefaultStyle()` 来设置窗口的默认样式。
+
+# NavigationWindow 导航窗口
+
+可通过 `ConfigHelper.Instance.SetNavigationWindowDefaultStyle()` 来设置导航窗口的默认样式。
\ No newline at end of file
diff --git a/doc/source/handycontrol/overview/index.md b/doc/source/handycontrol/overview/index.md
deleted file mode 100644
index 1140ffb6..00000000
--- a/doc/source/handycontrol/overview/index.md
+++ /dev/null
@@ -1,281 +0,0 @@
----
-title: 总览
----
-
-## 最新示例
-
-### 托盘图标
-
-
-
-### 对话框
-
-
-
-### 波形进度条
-
-
-
-### 标记
-
-
-
-### 头像
-
-
-
-## 历史发布
-
-### 回到顶部
-
-
-
-### 对话气泡
-
-
-
-### 标签
-
-
-
-### 穿梭框
-
-
-
-### 进度按钮
-
-
-
-### 封面流
-
-
-
-### 封面视图
-
-
-
-### 消息对话框
-
-
-
-### 瀑布流
-
-
-
-### 评分
-
-
-
-### 背景模糊窗口
-
-
-
-### 翻页时钟
-
-
-
-### 徽章
-
-
-
-### 轮廓文本
-
-
-
-### 标签
-
-
-
-### 工具条
-
-
-
-### 滑块
-
-
-
-### 圆形进度条
-
-
-
-### 按钮
-
-
-
-### 切换按钮
-
-
-
-### 单选按钮
-
-
-
-### 复选框
-
-
-
-### 列表框
-
-
-
-### 树视图
-
-
-
-### 列表视图
-
-
-
-### 数据表格
-
-
-
-### 现在你可以切换到黑色主题了
-
-
-
-### 颜色拾取器
-
-
-
-### 加载条
-
-
-
-### 轮播
-
-
-
-### 页码条
-
-
-
-### 展开框
-
-
-
-### 时间条
-
-
-
-### 图片浏览器
-
-
-
-### 预览滑块
-
-
-
-### 对比滑块
-
-
-
-
-
-### 信息通知
-
-
-
-### 动画路径
-
-
-
-### 进度条
-
-
-
-### 选项卡控件
-
-
-
-### 选项卡控件
-
-
-
-### 分组框
-
-
-
-### 步骤条
-
-
-
-### Gif图片
-
-
-
-### 上下文菜单
-
-
-
-### 日历
-
-
-
-### 时钟
-
-
-
-### 带有时钟的日历
-
-
-
-### 文本块
-
-
-
-### 富文本框
-
-
-
-### 文本框
-
-
-
-### 组合框
-
-
-
-### 数值选择控件
-
-
-
-### 步骤条
-
-
-
-### 密码框
-
-
-
-### 日期选择器
-
-
-
-### 时间选择器
-
-
-
-### 日期时间选择器
-
-
-
-### 滚动视图
-
-
-
-### 圆形布局
-
-
-
-### 边框
-
-
-
-### 画刷
-
-
-
-## 配置切换
-
-
\ No newline at end of file
diff --git a/doc/source/handycontrol/specifications/index.md b/doc/source/handycontrol/specifications/index.md
deleted file mode 100644
index 57a08ee0..00000000
--- a/doc/source/handycontrol/specifications/index.md
+++ /dev/null
@@ -1,37 +0,0 @@
----
-title: 规范
----
-
-HandyControl中有一些贯穿全部生命周期的规范,此文档将逐条列举。
-
-# 样式命名规范
-
-- 带有BaseStyle后缀的样式,不推荐在视图层使用,而适合于扩展。
-
-{% note info %}
-例如`ButtonBaseStyle`、`ComboBoxBaseStyle`。
-{% endnote %}
-
-- 带有Extend字样的样式,为原生控件样式的扩展模式,它比没有该字样的样式多一些功能。
-
-{% note info %}
-例如`ComboBoxExtendBaseStyle`、`TextBoxExtendBaseStyle`。
-{% endnote %}
-
-- 带有Plus字样的样式,为扩展控件的默认样式,它比`Extend`样式多一些功能。
-
-{% note info %}
-例如`ComboBoxPlusBaseStyle`、`TextBoxPlusBaseStyle`。
-{% endnote %}
-
-{% note info %}
-如果一个控件拥有`Plus`样式,说明在原生库中存在与其同名的控件。
-{% endnote %}
-
-# 控件命名规范
-
-- 功能和原生控件相似的扩展控件一般名称和原生控件一致。
-
-{% note info %}
-例如`Window`、`TabControl`、`ScrollViewer`,原生库中有这三个控件,但是HandyControl中也有,且名称一致。
-{% endnote %}
\ No newline at end of file
diff --git a/doc/source/handycontrol/tnx/index.md b/doc/source/handycontrol/tnx/index.md
index 129c2af4..ca232716 100644
--- a/doc/source/handycontrol/tnx/index.md
+++ b/doc/source/handycontrol/tnx/index.md
@@ -4,16 +4,12 @@ title: 鸣谢
# 感谢以下Coder提供代码贡献
-





-
-# 感谢以下User提供使用建议
-
-
+









# 感谢以下组织机构提供开源许可
-
+
# 感谢以下捐赠者
-



\ No newline at end of file
+












\ No newline at end of file
diff --git a/doc/source/handycontrol/tools/effect/index.md b/doc/source/handycontrol/tools/effect/index.md
new file mode 100644
index 00000000..a82e557d
--- /dev/null
+++ b/doc/source/handycontrol/tools/effect/index.md
@@ -0,0 +1,3 @@
+---
+title: Effect
+---
diff --git a/doc/source/handycontrol/tools/hatchBrushGenerator/index.md b/doc/source/handycontrol/tools/hatchBrushGenerator/index.md
new file mode 100644
index 00000000..c3ab9e7e
--- /dev/null
+++ b/doc/source/handycontrol/tools/hatchBrushGenerator/index.md
@@ -0,0 +1,3 @@
+---
+title: HatchBrushGenerator
+---
diff --git a/doc/source/handycontrol/tools/morphingAnimation/index.md b/doc/source/handycontrol/tools/morphingAnimation/index.md
new file mode 100644
index 00000000..206d5770
--- /dev/null
+++ b/doc/source/handycontrol/tools/morphingAnimation/index.md
@@ -0,0 +1,3 @@
+---
+title: MorphingAnimation
+---
diff --git a/doc/source/handykeras/index.md b/doc/source/handykeras/index.md
deleted file mode 100644
index 76441549..00000000
--- a/doc/source/handykeras/index.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: handykeras
-date: 2019-04-02 00:03:48
----
diff --git a/doc/themes/next/_config.yml b/doc/themes/next/_config.yml
index 92a82f52..6e310349 100644
--- a/doc/themes/next/_config.yml
+++ b/doc/themes/next/_config.yml
@@ -158,12 +158,10 @@ baidu_push: false
# External url should start with http:// or https://
menu:
主页: / ||
- HandyControl:
+ HandyControl - 2.4.0:
default: /handycontrol/ ||
鸣谢: /tnx/ ||
快速开始: /quick_start/ ||
- # 总览: /overview/ ||
- # 规范: /specifications/ ||
基础xaml定义:
default: /basic_xaml/ ||
行为: /behaviors/ ||
@@ -180,13 +178,15 @@ menu:
BackgroundSwitchElement 可切换背景的元素: /backgroundSwitchElement/ ||
BorderElement 具有边框的元素: /borderElement/ ||
DataGridAttach DataGrid专用: /dataGridAttach/ ||
- EdgeElement: /edgeElement/ ||
+ EdgeElement 具有边界内容的元素: /edgeElement/ ||
IconElement 具有图标的元素: /iconElement/ ||
IconSwitchElement 可切换图标的元素: /iconSwitchElement/ ||
InfoElement 信息元素: /infoElement/ ||
PanelElement 面板元素: /panelElement/ ||
PasswordBoxAttach 密码框专用: /passwordBoxAttach/ ||
+ RectangleAttach Rectangle专用: /rectangleAttach/ ||
StatusSwitchElement 可切换状态的元素: /statusSwitchElement/ ||
+ TextBlockAttach 文本块专用: /textBlockAttach/ ||
TipElement 提示元素: /tipElement/ ||
TitleElement 标题元素: /titleElement/ ||
VisualElement 可视化元素: /visualElement/ ||
@@ -203,6 +203,8 @@ menu:
DataGrid 数据表格: /dataGrid/ ||
DatePicker 日期选择器: /datePicker/ ||
Expander 展开框: /expander/ ||
+ FlowDocument 流文档: /flowDocument/ ||
+ Frame 导航框架: /frame/ ||
GroupBox 分组框: /groupBox/ ||
Image 图片: /image/ ||
Label 标签: /label/ ||
@@ -214,7 +216,9 @@ menu:
RadioButton 单选按钮: /radioButton/ ||
RichTextBox 富文本框: /richTextBox/ ||
ScrollViewer 滚动视图: /scrollViewer/ ||
+ Seperator 分隔符: /seperator/ ||
Slider 滑块: /slider/ ||
+ StatusBar 状态栏: /statusBar/ ||
TabControl 选项卡控件: /tabControl/ ||
TextBlock 文本块: /textBlock/ ||
TextBox 文本框: /textBox/ ||
@@ -227,8 +231,10 @@ menu:
default: /extend_controls/ ||
AnimationPath 动画路径: /animationPath/ ||
Badge 标记: /badge/ ||
+ ButtonGroup : /buttonGroup/ ||
BlurWindow 背景模糊窗口: /blurWindow/ ||
CalendarWithClock 带有时钟的日历: /calendarWithClock/ ||
+ Card 卡片: /card/ ||
Carousel 轮播: /carousel/ ||
ChatBubble 对话气泡: /chatBubble/ ||
CirclePanel 圆形布局: /circlePanel/ ||
@@ -242,30 +248,46 @@ menu:
DatePicker 日期选择器: /datePicker/ ||
DateTimePicker 日期时间选择器: /dateTimePicker/ ||
Dialog 对话框: /dialog/ ||
+ Divider 分割线: /divider/ ||
+ Drawer 抽屉: /drawer/ ||
FlipClock 翻页时钟: /flipClock/ ||
+ FloatingBlock 漂浮块: /floatingBlock/ ||
GifImage Gif图片: /gifImage/ ||
GotoTop 回到顶部: /gotoTop/ ||
Gravatar 头像: /gravatar/ ||
+ Grid 栅格: /grid/ ||
Growl 信息通知: /growl/ ||
+ HoneycombPanel 蜂窝布局: /honeycombPanel/ ||
+ ImageBlock 图片块: /imageBlock/ ||
ImageBrowser 图片浏览器: /imageBrowser/ ||
ImageViewer 图片视图: /imageViewer/ ||
Loading 加载条: /loading/ ||
+ Magnifier 放大镜: /magnifier/ ||
MessageBox 消息对话框: /messageBox/ ||
+ Notification 桌面通知: /notification/ ||
NotifyIcon 托盘图标: /notifyIcon/ ||
NumericUpDown 数值选择控件: /numericUpDown/ ||
OutlineText 轮廓文本: /outlineText/ ||
Pagination 页码条: /pagination/ ||
PasswordBox 密码框: /passwordBox/ ||
+ PinBox PIN码框: /pinBox/ ||
+ PopTip 气泡提示: /popTip/ ||
PopupWindow 弹出窗口: /popupWindow/ ||
PreviewSlider 预览滑块: /previewSlider/ ||
ProgressButton 进度按钮: /progressButton/ ||
+ RangeSlider 范围滑块: /rangeSlider/ ||
RadioGroup 单选按钮组: /radioGroup/ ||
Rate 评分: /rate/ ||
+ RelativePanel 相对布局: /relativePanel/ ||
+ RunningBlock 滚动块: /runningBlock/ ||
ScrollViewer 滚动视图: /scrollViewer/ ||
SearchBar 搜索栏: /searchBar/ ||
Shield 徽章: /shield/ ||
+ SideMenu 侧边菜单: /sideMenu/ ||
SimpleItemsControl 简单项目控件: /simpleItemsControl/ ||
SimplePanel 简单面板: /simplePanel/ ||
+ SplitButton 分割按钮: /splitButton/ ||
+ Sprite 精灵: /sprite/ ||
StepBar 步骤条: /stepBar/ ||
TabControl 选项卡控件: /tabControl/ ||
Tag 标签: /tag/ ||
@@ -283,6 +305,9 @@ menu:
InfoType: /InfoType/ ||
工具和扩展:
default: /tools/ ||
+ Effect 效果: /effect/ ||
+ HatchBrushGenerator 阴影画笔生成器: /hatchBrushGenerator/ ||
+ MorphingAnimation 变形动画: /morphingAnimation/ ||
国际化:
default: /langs/ ||
@@ -319,10 +344,12 @@ site_state: false
social:
GitHub: https://github.com/HandyOrg || github
E-Mail: mailto:handycontrol@qq.com || envelope
- QQ: //shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1 || qq
+ QQ群1: //shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1 || qq
+ QQ群2: //shang.qq.com/wpa/qunwpa?idkey=5c18622a0f6ee07a6f33afa8cdb85b1f72ea50e878271dfcec919c76b55afee7 || qq
Nuget: https://www.nuget.org/packages/HandyControl || code
Gitter: https://gitter.im/HandyControl/Lobby || commenting
Wiki-en: https://github.com/ghost1372/HandyControl/wiki || book
+ Wiki-fr: https://github.com/TheKeytrap/HandyControl/wiki || book
social_icons:
enable: true
@@ -872,7 +899,7 @@ needmoreshare2:
# localhost_ignored: true
# CNZZ count
-#cnzz_siteid:
+cnzz_siteid: 1278600916
# Application Insights
# See: https://azure.microsoft.com/en-us/services/application-insights
diff --git a/doc/themes/next/layout/_third-party/analytics/cnzz-analytics.swig b/doc/themes/next/layout/_third-party/analytics/cnzz-analytics.swig
index 9693cda2..f9519141 100644
--- a/doc/themes/next/layout/_third-party/analytics/cnzz-analytics.swig
+++ b/doc/themes/next/layout/_third-party/analytics/cnzz-analytics.swig
@@ -1,5 +1,3 @@
{% if theme.cnzz_siteid %}
-
-
-
+
{% endif %}
diff --git a/doc/themes/next/source/css/_custom/custom.styl b/doc/themes/next/source/css/_custom/custom.styl
index 5a664b44..371e0204 100644
--- a/doc/themes/next/source/css/_custom/custom.styl
+++ b/doc/themes/next/source/css/_custom/custom.styl
@@ -3,4 +3,21 @@
margin: 3px;
display: inline;
padding: 3px !important;
+ border: 0;
+}
+
+.post-body h2 {
+ font-size: 1.45em;
+ border-bottom: 0px solid #eee;
+}
+
+a, span.exturl {
+ overflow-wrap: break-word;
+ word-wrap: break-word;
+ background-color: transparent;
+ color: #555;
+ text-decoration: none;
+ outline: none;
+ border-bottom: 0px solid #999;
+ cursor: pointer;
}
\ No newline at end of file
diff --git a/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj b/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj
deleted file mode 100644
index 0bd1c286..00000000
--- a/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
- netcoreapp3.0
- true
- HandyControl
- HandyControl
- 2.1.0
- 2.1.0.0
- false
- false
- Copyright © HandyOrg 2018-2019
- Contains some commonly used simple WPF controls
- Debug;Release
- latest
-
-
- TRACE;Core
-
-
- TRACE;Core
- C:\Code\GitHub\HandyControl\src\Core_30\HandyControl_Core_30\HandyControl.xml
-
-
-
- Properties\Langs\Lang.Designer.cs
- True
- True
- Lang.resx
-
-
-
-
- Properties\Langs\Lang.en.resx
-
-
- Properties\Langs\Lang.resx
- PublicResXFileCodeGenerator
- Lang.Designer.cs
-
-
- Properties\AssemblyInfo.cs
-
-
-
-
-
-
-
-
- Resources\dropper.cur
-
-
-
\ No newline at end of file
diff --git a/src/Core_30/HandyControl_Core_30/Themes/Styles/Growl.xaml b/src/Core_30/HandyControl_Core_30/Themes/Styles/Growl.xaml
deleted file mode 100644
index d28b4fa2..00000000
--- a/src/Core_30/HandyControl_Core_30/Themes/Styles/Growl.xaml
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj b/src/Core_GE30/HandyControlDemo_Core_GE30/HandyControlDemo_Core_GE30.csproj
similarity index 73%
rename from src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
rename to src/Core_GE30/HandyControlDemo_Core_GE30/HandyControlDemo_Core_GE30.csproj
index 760f6243..a599d3eb 100644
--- a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
+++ b/src/Core_GE30/HandyControlDemo_Core_GE30/HandyControlDemo_Core_GE30.csproj
@@ -1,29 +1,40 @@
WinExe
- netcoreapp3.0
true
HandyControlDemo
HandyControlDemo
- 2.1.0
+ 2.5.0
..\..\Shared\HandyControlDemo_Shared\Resources\Img\icon.ico
- Debug;Release
- Copyright © HandyOrg 2018-2019
- 2.1.0.0
- 2.1.0.0
- latest
+ Debug-Core30;Debug-Core31;Release-Core30;Release-Core31
+ Copyright © HandyOrg 2018-2020
+ 2.5.0
+ 2.5.0
+ 8.0
+ HandyOrg
-
+
TRACE;Core
+ netcoreapp3.0
-
+
TRACE;Core
+ netcoreapp3.1
+
+
+ TRACE;Core
+ netcoreapp3.0
+
+
+ TRACE;Core
+ netcoreapp3.1
+
-
+
@@ -45,9 +56,46 @@
-
+
+
+
+ Data\DemoInfo.json
+
+
+ Resources\Img\Cover.png
+
+
+ Resources\Img\QQ\1.gif
+
+
+ Resources\Img\QQ\2.gif
+
+
+ Resources\Img\QQ\3.gif
+
+
+ Resources\Img\QQ\4.gif
+
+
+ Resources\Img\QQ\5.gif
+
+
+ Resources\Img\QQ\6.gif
+
+
+ Resources\Img\QQ\7.gif
+
+
+ Resources\Img\QQ\8.gif
+
+
+ Resources\Img\QQ\9.gif
+
+
+ Resources\Img\QQ\10.gif
+
Resources\Img\1.jpg
@@ -132,12 +180,24 @@
Resources\Img\Flag\en.png
+
+ Resources\Img\Flag\fa.png
+
+
+ Resources\Img\Flag\fr.png
+
Resources\Img\icon-white.ico
Resources\Img\icon.ico
+
+ Resources\Img\qq_group_1.jpg
+
+
+ Resources\Img\qq_group_2.jpg
+
Resources\Img\LeftMainContent\Animation_16x.png
@@ -324,9 +384,6 @@
Resources\Img\LeftMainContent\GridPane_16x.png
-
- Resources\Img\qq-group.jpg
-
Resources\Img\under_construction.gif
@@ -351,6 +408,9 @@
Resources\fabric-icons.ttf
+
+ Resources\Registry.txt
+
Resources\Img\LeftMainContent\brackets_Square_16xLG.png
@@ -363,20 +423,91 @@
Resources\Img\LeftMainContent\ImageStack_16x.png
+
+ Resources\Img\LeftMainContent\Dynamic_16x.png
+
+
+ Resources\Img\LeftMainContent\PolygonHexagon_16x.png
+
+
+ Resources\Img\LeftMainContent\HandyControl.png
+
+
+ Resources\Img\LeftMainContent\Procedure_16x.png
+
Resources\Img\Dance.png
+
+ Resources\Img\LeftMainContent\thumbs_up.png
+
+
+ Resources\Img\LeftMainContent\SplitButton_16x.png
+
+
+ Resources\Img\LeftMainContent\DataGenerator_16x.png
+
+
+ Resources\Img\LeftMainContent\DottedSplitter_16x.png
+
+
+ Resources\Img\LeftMainContent\PopupCursor_16x.png
+
+
+ Resources\Img\LeftMainContent\TransitioningContentControl_16x.png
+
+
+ Resources\Img\LeftMainContent\View_Portrait_16x.png
+
+
+ Resources\Img\LeftMainContent\TransformRelative_16x.png
+
+
+ Resources\Img\LeftMainContent\Effects_16x.png
+
+
+ Resources\Img\LeftMainContent\Ellipsis_16x.png
+
+
+ Resources\Img\LeftMainContent\WPFFlowDocument_16x.png
+
+
+ Resources\Img\LeftMainContent\OutlinedRectangleTool_16x.png
+
+
+ Resources\Img\LeftMainContent\frame_16xLG.png
+
+
+ Resources\Img\cloud.png
+
+
+ Resources\Img\LeftMainContent\WindowScreenshot_16x.png
+
Properties\Langs\Lang.en.resx
+
+ Properties\Langs\Lang.fa.resx
+
+
+ Properties\Langs\Lang.fr.resx
+
+
+ Properties\Langs\Lang.ko-KR.resx
+
Properties\Langs\Lang.resx
PublicResXFileCodeGenerator
Lang.Designer.cs
+
+
+ Properties\App.config
+
+
Data\MessageToken.tt
diff --git a/src/Core_GE30/HandyControl_Core_GE30/HandyControl_Core_GE30.csproj b/src/Core_GE30/HandyControl_Core_GE30/HandyControl_Core_GE30.csproj
new file mode 100644
index 00000000..149c7f6b
--- /dev/null
+++ b/src/Core_GE30/HandyControl_Core_GE30/HandyControl_Core_GE30.csproj
@@ -0,0 +1,140 @@
+
+
+ true
+ HandyControl
+ HandyControl
+ 2.5.0
+ 2.5.0
+ false
+ false
+ Copyright © HandyOrg 2018-2020
+ Contains some commonly used simple WPF controls
+ Debug-Core30;Debug-Core31;Release-Core30;Release-Core31
+ 8.0
+ HandyOrg
+
+
+ TRACE;Core
+ netcoreapp3.0
+
+
+ TRACE;Core
+ netcoreapp3.1
+
+
+ TRACE;Core
+ netcoreapp3.0
+ C:\Code\GitHub\HandyControl\src\Core_GE30\HandyControl_Core_GE30\HandyControl.xml
+
+
+ TRACE;Core
+ netcoreapp3.1
+ C:\Code\GitHub\HandyControl\src\Core_GE30\HandyControl_Core_GE30\HandyControl.xml
+
+
+
+ Properties\Langs\Lang.Designer.cs
+ True
+ True
+ Lang.resx
+
+
+
+
+ Properties\Langs\Lang.en.resx
+
+
+ Properties\Langs\Lang.fa.resx
+
+
+ Properties\Langs\Lang.fr.resx
+
+
+ Properties\Langs\Lang.ko-KR.resx
+
+
+ Properties\Langs\Lang.resx
+ PublicResXFileCodeGenerator
+ Lang.Designer.cs
+
+
+ Properties\CoreAssemblyInfo.cs
+
+
+
+
+
+
+
+
+ Resources\dropper.cur
+
+
+
+
+ Resources\Effects\BrightnessEffect.ps
+
+
+ Resources\Effects\ColorComplementEffect.ps
+
+
+ Resources\Effects\ColorMatrixEffect.ps
+
+
+ Resources\Effects\ContrastEffect.ps
+
+
+ Resources\Effects\GrayScaleEffect.ps
+
+
+
+
+ Resources\Images\GlowWindow\bottom.png
+
+
+ Resources\Images\GlowWindow\bottomleft.png
+
+
+ Resources\Images\GlowWindow\bottomright.png
+
+
+ Resources\Images\GlowWindow\cornerbottomleft.png
+
+
+ Resources\Images\GlowWindow\cornerbottomright.png
+
+
+ Resources\Images\GlowWindow\cornertopleft.png
+
+
+ Resources\Images\GlowWindow\cornertopright.png
+
+
+ Resources\Images\GlowWindow\left.png
+
+
+ Resources\Images\GlowWindow\leftbottom.png
+
+
+ Resources\Images\GlowWindow\lefttop.png
+
+
+ Resources\Images\GlowWindow\right.png
+
+
+ Resources\Images\GlowWindow\rightbottom.png
+
+
+ Resources\Images\GlowWindow\righttop.png
+
+
+ Resources\Images\GlowWindow\top.png
+
+
+ Resources\Images\GlowWindow\topleft.png
+
+
+ Resources\Images\GlowWindow\topright.png
+
+
+
\ No newline at end of file
diff --git a/src/Core_30/HandyControl_Core_30/Themes/Styles/Base/ComboBoxBaseStyle.xaml b/src/Core_GE30/HandyControl_Core_GE30/Themes/Styles/Base/ComboBoxBaseStyle.xaml
similarity index 95%
rename from src/Core_30/HandyControl_Core_30/Themes/Styles/Base/ComboBoxBaseStyle.xaml
rename to src/Core_GE30/HandyControl_Core_GE30/Themes/Styles/Base/ComboBoxBaseStyle.xaml
index d8f26026..f57cf567 100644
--- a/src/Core_30/HandyControl_Core_30/Themes/Styles/Base/ComboBoxBaseStyle.xaml
+++ b/src/Core_GE30/HandyControl_Core_GE30/Themes/Styles/Base/ComboBoxBaseStyle.xaml
@@ -1,8 +1,8 @@
+ xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
+ xmlns:system="clr-namespace:System;assembly=mscorlib">
@@ -22,7 +22,7 @@
-
+
@@ -121,6 +121,9 @@
+
+
+
@@ -132,7 +135,7 @@
-
+
@@ -184,6 +187,9 @@
+
+
+
@@ -193,13 +199,13 @@
-
+
-
+
@@ -245,6 +251,9 @@
+
+
+
@@ -334,7 +343,7 @@
-
+
@@ -398,13 +407,13 @@
-
+
-
+
@@ -528,10 +537,11 @@
-
-
+
+
-
-
\ No newline at end of file
diff --git a/src/Net_40/HandyControl_Net_40/Themes/Styles/MessageBox.xaml b/src/Net_40/HandyControl_Net_40/Themes/Styles/MessageBox.xaml
index 7c7789d7..8af1741b 100644
--- a/src/Net_40/HandyControl_Net_40/Themes/Styles/MessageBox.xaml
+++ b/src/Net_40/HandyControl_Net_40/Themes/Styles/MessageBox.xaml
@@ -74,7 +74,7 @@
-
+
diff --git a/src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml b/src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml
index 526c868b..a9e520ac 100644
--- a/src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml
+++ b/src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml
@@ -49,30 +49,27 @@
-
-
+
+
-
-
+
+
+
+
@@ -94,4 +99,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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..c3517b70 100644
--- a/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs
+++ b/src/Shared/HandyControlDemo_Shared/Service/Data/DataService.cs
@@ -2,8 +2,10 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
+using System.IO;
using System.Linq;
using System.Net;
+using System.Windows;
using HandyControl.Data;
using HandyControlDemo.Data;
using HandyControlDemo.Tools.Converter;
@@ -13,6 +15,38 @@ namespace HandyControlDemo.Service
{
public class DataService
{
+ internal ObservableCollection GetTabControlDemoDataList()
+ {
+ return new ObservableCollection
+ {
+ new TabControlDemoModel
+ {
+ Header = "Success",
+ BackgroundToken = ResourceToken.SuccessBrush
+ },
+ new TabControlDemoModel
+ {
+ Header = "Primary",
+ BackgroundToken = ResourceToken.PrimaryBrush
+ },
+ new TabControlDemoModel
+ {
+ Header = "Warning",
+ BackgroundToken = ResourceToken.WarningBrush
+ },
+ new TabControlDemoModel
+ {
+ Header = "Danger",
+ BackgroundToken = ResourceToken.DangerBrush
+ },
+ new TabControlDemoModel
+ {
+ Header = "Info",
+ BackgroundToken = ResourceToken.InfoBrush
+ }
+ };
+ }
+
internal List GetDemoDataList()
{
var list = new List();
@@ -147,19 +181,26 @@ namespace HandyControlDemo.Service
DisplayName = "AutumnBox",
AvatarUri = "https://www.atmb.top/images/leaves.png",
Link = "https://github.com/zsh2401/AutumnBox"
- },
- new AvatarModel
- {
- DisplayName = "PandaX Studio",
- AvatarUri = "https://raw.githubusercontent.com/aboutlong/pandaxstudio/master/pandax/pandax/source/image/logo.png",
- Link = "https://github.com/aboutlong/pandaxstudio"
}
};
}
- internal List GetCardDataList()
+ internal List GetWebsiteDataList()
{
- return new List
+ return new List
+ {
+ new AvatarModel
+ {
+ DisplayName = "Dotnet9",
+ AvatarUri = "https://pic.cnblogs.com/avatar/1663243/20191124121029.png",
+ Link = "https://dotnet9.com/"
+ }
+ };
+ }
+
+ internal ObservableCollection GetCardDataList()
+ {
+ return new ObservableCollection
{
new CardModel
{
@@ -224,6 +265,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
@@ -307,5 +356,58 @@ namespace HandyControlDemo.Service
}
};
}
+
+ internal List GetDemoInfo()
+ {
+ var infoList = new List();
+
+ var stream = Application.GetResourceStream(new Uri("Data/DemoInfo.json", UriKind.Relative))?.Stream;
+ if (stream == null) return infoList;
+
+ string jsonStr;
+ using (var reader = new StreamReader(stream))
+ {
+ jsonStr = reader.ReadToEnd();
+ }
+
+ var jsonObj = JsonConvert.DeserializeObject(jsonStr);
+ foreach (var item in jsonObj)
+ {
+ var titleKey = (string) item.title;
+ var title = Properties.Langs.Lang.ResourceManager.GetString(titleKey);
+ var list = Convert2DemoItemList(item.demoItemList);
+ infoList.Add(new DemoInfoModel
+ {
+ Key = titleKey,
+ Title = title,
+ DemoItemList = list
+ });
+ }
+
+ return infoList;
+ }
+
+ private List Convert2DemoItemList(dynamic list)
+ {
+ var resultList = new List();
+
+ foreach (var item in list)
+ {
+ var name = Properties.Langs.Lang.ResourceManager.GetString((string)item[0]);
+ string targetCtlName = item[1];
+ string imageName = item[2];
+ var isNew = !string.IsNullOrEmpty((string)item[3]);
+
+ resultList.Add(new DemoItemModel
+ {
+ Name = name,
+ TargetCtlName = targetCtlName,
+ ImageName = $"../../Resources/Img/LeftMainContent/{imageName}.png",
+ IsNew = isNew
+ });
+ }
+
+ return resultList;
+ }
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Tools/Converter/HatchBrushConverter.cs b/src/Shared/HandyControlDemo_Shared/Tools/Converter/HatchBrushConverter.cs
new file mode 100644
index 00000000..6581b245
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/Tools/Converter/HatchBrushConverter.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Media;
+using HandyControl.Data;
+using HandyControl.Tools;
+
+namespace HandyControlDemo.Tools.Converter
+{
+ public class HatchBrushConverter : IValueConverter
+ {
+ private readonly HatchBrushGenerator _brushGenerator;
+
+ public HatchBrushConverter()
+ {
+ _brushGenerator = new HatchBrushGenerator();
+ }
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is HatchStyle style)
+ {
+ return _brushGenerator.GetHatchBrush(style, ResourceHelper.GetResource(ResourceToken.DarkPrimaryColor), ResourceHelper.GetResource(ResourceToken.BackgroundColor));
+ }
+ return Brushes.Transparent;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/Tools/Converter/String2BrushConverter.cs b/src/Shared/HandyControlDemo_Shared/Tools/Converter/String2BrushConverter.cs
index e837c305..e2fcc4cc 100644
--- a/src/Shared/HandyControlDemo_Shared/Tools/Converter/String2BrushConverter.cs
+++ b/src/Shared/HandyControlDemo_Shared/Tools/Converter/String2BrushConverter.cs
@@ -10,7 +10,7 @@ namespace HandyControlDemo.Tools.Converter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- return value is string str ? ResourceHelper.GetResource(str) : default(Brush);
+ return value is string str ? ResourceHelper.GetResource(str) : default;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
diff --git a/src/Shared/HandyControlDemo_Shared/Tools/Helper/ExternDllHelper.cs b/src/Shared/HandyControlDemo_Shared/Tools/Helper/ExternDllHelper.cs
deleted file mode 100644
index a5d0e53d..00000000
--- a/src/Shared/HandyControlDemo_Shared/Tools/Helper/ExternDllHelper.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace HandyControlDemo.Tools
-{
- internal class ExternDllHelper
- {
- private const string Winmm = "winmm.dll";
-
- [DllImport(Winmm, EntryPoint = "mciSendString", CharSet = CharSet.Auto)]
- public static extern int MciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
- }
-}
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Tools/Helper/Win32Helper.cs b/src/Shared/HandyControlDemo_Shared/Tools/Helper/Win32Helper.cs
new file mode 100644
index 00000000..c8929ae9
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/Tools/Helper/Win32Helper.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace HandyControlDemo.Tools
+{
+ internal class Win32Helper
+ {
+ [DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
+ public static extern bool SetForegroundWindow(IntPtr hWnd);
+
+ [DllImport("winmm.dll", EntryPoint = "mciSendString", CharSet = CharSet.Auto)]
+ public static extern int MciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Basic/ChatBox.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Basic/ChatBox.xaml
index 2615146f..c8e06311 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Basic/ChatBox.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Basic/ChatBox.xaml
@@ -16,7 +16,7 @@
-
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Basic/ChatBox.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Basic/ChatBox.xaml.cs
index affe29d0..10a70ab1 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Basic/ChatBox.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Basic/ChatBox.xaml.cs
@@ -1,10 +1,27 @@
-namespace HandyControlDemo.UserControl
+using System.Windows.Controls;
+using HandyControl.Tools;
+
+namespace HandyControlDemo.UserControl
{
public partial class ChatBox
{
+ private ScrollViewer _scrollViewer;
+
public ChatBox()
{
InitializeComponent();
+
+ ListBoxChat.ItemContainerGenerator.ItemsChanged += ItemContainerGenerator_ItemsChanged;
+ }
+
+ private void ItemContainerGenerator_ItemsChanged(object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs e)
+ {
+ if (_scrollViewer == null)
+ {
+ _scrollViewer = VisualHelper.GetChild(ListBoxChat);
+ }
+
+ _scrollViewer?.ScrollToBottom();
}
}
}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml
new file mode 100644
index 00000000..37fb29ea
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml.cs
new file mode 100644
index 00000000..7cd8f16f
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class DividerDemoCtl
+ {
+ public DividerDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DrawerDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DrawerDemoCtl.xaml
new file mode 100644
index 00000000..3da2d201
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DrawerDemoCtl.xaml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DrawerDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DrawerDemoCtl.xaml.cs
new file mode 100644
index 00000000..81259d96
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DrawerDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class DrawerDemoCtl
+ {
+ public DrawerDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/FloatingBlockDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/FloatingBlockDemoCtl.xaml
new file mode 100644
index 00000000..338b7430
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/FloatingBlockDemoCtl.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/FloatingBlockDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/FloatingBlockDemoCtl.xaml.cs
new file mode 100644
index 00000000..f7cbc776
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/FloatingBlockDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class FloatingBlockDemoCtl
+ {
+ public FloatingBlockDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GotoTopDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GotoTopDemoCtl.xaml
index 6ccca191..6ab499a8 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GotoTopDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GotoTopDemoCtl.xaml
@@ -5,7 +5,7 @@
Background="{DynamicResource RegionBrush}">
-
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GridDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GridDemoCtl.xaml
index eccc1566..df298e28 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GridDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GridDemoCtl.xaml
@@ -139,10 +139,10 @@
-
+
-
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GrowlDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GrowlDemoCtl.xaml
index 5d229ef7..3d06771c 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GrowlDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/GrowlDemoCtl.xaml
@@ -7,16 +7,29 @@
Background="{DynamicResource RegionBrush}">
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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..fb6370d1
--- /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/NotificationDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NotificationDemoCtl.xaml
new file mode 100644
index 00000000..0f0cdf27
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NotificationDemoCtl.xaml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NotificationDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NotificationDemoCtl.xaml.cs
new file mode 100644
index 00000000..4a86ef88
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NotificationDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class NotificationDemoCtl
+ {
+ public NotificationDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NotifyIconDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NotifyIconDemoCtl.xaml
index 98d1ac7c..36c6aeac 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NotifyIconDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NotifyIconDemoCtl.xaml
@@ -3,55 +3,60 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
xmlns:hc="https://handyorg.github.io/handycontrol"
- xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
- xmlns:command="http://www.galasoft.ch/mvvmlight"
+ xmlns:data="clr-namespace:HandyControlDemo.Data"
DataContext="{Binding NotifyIconDemo,Source={StaticResource Locator}}"
Background="{DynamicResource RegionBrush}">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
+
@@ -61,14 +66,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NumericUpDownDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NumericUpDownDemoCtl.xaml
index 77fb878d..7ac08446 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NumericUpDownDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NumericUpDownDemoCtl.xaml
@@ -7,8 +7,9 @@
-
+
+
@@ -18,6 +19,7 @@
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/OutlineTextDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/OutlineTextDemoCtl.xaml
index a8ccd7e0..21762990 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/OutlineTextDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/OutlineTextDemoCtl.xaml
@@ -11,6 +11,8 @@
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PaginationDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PaginationDemoCtl.xaml
index f4695b25..84474d60 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PaginationDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PaginationDemoCtl.xaml
@@ -26,17 +26,17 @@
-
+
-
+
-
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PasswordBoxDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PasswordBoxDemoCtl.xaml
index 32b35dc6..d6781b14 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PasswordBoxDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PasswordBoxDemoCtl.xaml
@@ -14,7 +14,6 @@
-
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PinBoxDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PinBoxDemoCtl.xaml
new file mode 100644
index 00000000..728c99a3
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PinBoxDemoCtl.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PinBoxDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PinBoxDemoCtl.xaml.cs
new file mode 100644
index 00000000..02c0ca3a
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PinBoxDemoCtl.xaml.cs
@@ -0,0 +1,21 @@
+using System.Windows;
+using HandyControl.Controls;
+
+namespace HandyControlDemo.UserControl
+{
+ public partial class PinBoxDemoCtl
+ {
+ public PinBoxDemoCtl()
+ {
+ InitializeComponent();
+ }
+
+ private void PinBox_OnCompleted(object sender, RoutedEventArgs e)
+ {
+ if (e.OriginalSource is PinBox pinBox)
+ {
+ Growl.Info(pinBox.Password);
+ }
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml
new file mode 100644
index 00000000..30891034
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml.cs
new file mode 100644
index 00000000..8daa08f5
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class PoptipDemoCtl
+ {
+ public PoptipDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PreviewSliderDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PreviewSliderDemoCtl.xaml
index 8fb39b03..5044f9cf 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PreviewSliderDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PreviewSliderDemoCtl.xaml
@@ -4,10 +4,17 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
Background="{DynamicResource RegionBrush}">
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ProgressButtonDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ProgressButtonDemoCtl.xaml
index b6dd935b..00aae1f9 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ProgressButtonDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ProgressButtonDemoCtl.xaml
@@ -7,20 +7,20 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RangeSliderDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RangeSliderDemoCtl.xaml
index 0dd0f1b7..8f4f3b99 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RangeSliderDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RangeSliderDemoCtl.xaml
@@ -8,14 +8,14 @@
-
-
+
+
-
-
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml
index 50fa38b9..87ca8eca 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml
@@ -1,6 +1,61 @@
-
+ xmlns:hc="https://handyorg.github.io/handycontrol"
+ Background="{DynamicResource RegionBrush}">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml.cs
index 39b53914..747c9b57 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml.cs
@@ -7,4 +7,4 @@
InitializeComponent();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml
new file mode 100644
index 00000000..da4df59c
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml.cs
new file mode 100644
index 00000000..a115d149
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class RunningBlockDemoCtl
+ {
+ public RunningBlockDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ScreenshotDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ScreenshotDemoCtl.xaml
new file mode 100644
index 00000000..85767c53
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ScreenshotDemoCtl.xaml
@@ -0,0 +1,10 @@
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ScreenshotDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ScreenshotDemoCtl.xaml.cs
new file mode 100644
index 00000000..7f237020
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ScreenshotDemoCtl.xaml.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using HandyControl.Controls;
+using HandyControl.Data;
+
+namespace HandyControlDemo.UserControl
+{
+ public partial class ScreenshotDemoCtl : IDisposable
+ {
+ public ScreenshotDemoCtl()
+ {
+ InitializeComponent();
+ Screenshot.Snapped += Screenshot_Snapped;
+ }
+
+ private void Screenshot_Snapped(object sender, FunctionEventArgs e)
+ {
+ new HandyControl.Controls.Window
+ {
+ Content = new Image
+ {
+ Source = e.Info,
+ Stretch = Stretch.None
+ },
+ WindowStartupLocation = WindowStartupLocation.CenterScreen
+ }.ShowDialog();
+ }
+
+ public void Dispose() => Screenshot.Snapped -= Screenshot_Snapped;
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ScrollViewerDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ScrollViewerDemoCtl.xaml
index f3838904..b65a090a 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ScrollViewerDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ScrollViewerDemoCtl.xaml
@@ -13,7 +13,7 @@
-
+
@@ -44,7 +44,7 @@
-
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SideMenuDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SideMenuDemoCtl.xaml
index 141f9322..2672b5a2 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SideMenuDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SideMenuDemoCtl.xaml
@@ -2,33 +2,31 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
- xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
- xmlns:command="http://www.galasoft.ch/mvvmlight"
DataContext="{Binding SideMenuDemo,Source={StaticResource Locator}}"
Background="{DynamicResource RegionBrush}">
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SplitButtonDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SplitButtonDemoCtl.xaml
new file mode 100644
index 00000000..60e55413
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SplitButtonDemoCtl.xaml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SplitButtonDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SplitButtonDemoCtl.xaml.cs
new file mode 100644
index 00000000..6c369070
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SplitButtonDemoCtl.xaml.cs
@@ -0,0 +1,17 @@
+using System.Windows;
+
+namespace HandyControlDemo.UserControl
+{
+ public partial class SplitButtonDemoCtl
+ {
+ public SplitButtonDemoCtl()
+ {
+ InitializeComponent();
+ }
+
+ private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
+ {
+ MessageBox.Show("123");
+ }
+ }
+}
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/Controls/TabControlDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TabControlDemoCtl.xaml
index a59e9b15..98f7378d 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TabControlDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TabControlDemoCtl.xaml
@@ -17,13 +17,13 @@
-
-
+
+
-
+
@@ -40,22 +40,22 @@
-
+
-
+
-
-
-
+
+
+
-
-
+
+
-
+
-
+
@@ -68,6 +68,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TabControlDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TabControlDemoCtl.xaml.cs
index 32d10ea9..7df67fc8 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TabControlDemoCtl.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TabControlDemoCtl.xaml.cs
@@ -1,5 +1,4 @@
-
-namespace HandyControlDemo.UserControl
+namespace HandyControlDemo.UserControl
{
public partial class TabControlDemoCtl
{
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TimeBarDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TimeBarDemoCtl.xaml.cs
index 5b91583c..8aec171c 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TimeBarDemoCtl.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TimeBarDemoCtl.xaml.cs
@@ -1,5 +1,4 @@
-
-namespace HandyControlDemo.UserControl
+namespace HandyControlDemo.UserControl
{
public partial class TimeBarDemoCtl
{
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml
new file mode 100644
index 00000000..b7d76fec
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml.cs
new file mode 100644
index 00000000..92a140ce
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class TransitioningContentControlDemoCtl
+ {
+ public TransitioningContentControlDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/WindowDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/WindowDemoCtl.xaml
index 7417064e..aeb6f37f 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/WindowDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/WindowDemoCtl.xaml
@@ -16,6 +16,9 @@
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/WindowDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/WindowDemoCtl.xaml.cs
index 0fee133f..b10b0577 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/WindowDemoCtl.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/WindowDemoCtl.xaml.cs
@@ -23,12 +23,12 @@ namespace HandyControlDemo.UserControl
{
MessageBox.Show(new MessageBoxInfo
{
- MessageBoxText = Properties.Langs.Lang.GrowlAsk,
+ Message = Properties.Langs.Lang.GrowlAsk,
Caption = Properties.Langs.Lang.Title,
Button = MessageBoxButton.YesNo,
IconBrushKey = ResourceToken.AccentBrush,
IconKey = ResourceToken.AskGeometry,
- Style = ResourceHelper.GetResource
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml.cs
index f7a69289..804ed03d 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml.cs
@@ -1,9 +1,11 @@
using System.ComponentModel;
-using System.Linq;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
using HandyControl.Data;
using HandyControl.Tools.Extension;
+using HandyControlDemo.Data;
+using HandyControlDemo.ViewModel;
namespace HandyControlDemo.UserControl
@@ -16,71 +18,45 @@ namespace HandyControlDemo.UserControl
public LeftMainContent()
{
InitializeComponent();
-
- /*You have to ask me why I made Border special.
- What drives me crazy is that if you don't do this,
- the content of ListBoxItemBorder will always be 1 !
- How amazing!
- I wish someone could tell me why. */
- ListBoxItemBorder.Content = Properties.Langs.Lang.Border;
}
private void TabControl_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.AddedItems.Count == 0) return;
- if (e.AddedItems[0] is TabItem tabItem && tabItem.Content is ListBox listBox)
+ if (e.AddedItems[0] is DemoInfoModel demoInfo)
{
- if (listBox.SelectedItem != null)
+ ViewModelLocator.Instance.Main.DemoInfoCurrent = demoInfo;
+ var selectedIndex = demoInfo.SelectedIndex;
+ demoInfo.SelectedIndex = -1;
+ demoInfo.SelectedIndex = selectedIndex;
+ }
+ }
+
+ private void ButtonAscending_OnClick(object sender, RoutedEventArgs e)
+ {
+ if (sender is ToggleButton button && button.Tag is ItemsControl itemsControl)
+ {
+ if (button.IsChecked == true)
{
- var item = listBox.SelectedItem;
- listBox.SelectedIndex = -1;
- listBox.SelectedItem = item;
+ itemsControl.Items.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
+ }
+ else
+ {
+ itemsControl.Items.SortDescriptions.Clear();
}
}
}
- private void ButtonStyleAscending_OnClick(object sender, RoutedEventArgs e)
- {
- if (ButtonStyleAscending.IsChecked == true)
- {
- ListBoxStyle.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
- }
- else
- {
- ListBoxStyle.Items.SortDescriptions.Clear();
- }
- }
-
- private void ButtonControlAscending_OnClick(object sender, RoutedEventArgs e)
- {
- if (ButtonControlAscending.IsChecked == true)
- {
- ListBoxControl.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
- }
- else
- {
- ListBoxControl.Items.SortDescriptions.Clear();
- }
- }
-
- private void SearchBarStyle_OnSearchStarted(object sender, FunctionEventArgs e)
+ private void SearchBar_OnSearchStarted(object sender, FunctionEventArgs e)
{
if (e.Info == null) return;
-
- foreach (var listBoxItem in ListBoxStyle.Items.OfType())
+ if (!(sender is FrameworkElement searchBar && searchBar.Tag is ListBox listBox)) return;
+ foreach (DemoItemModel item in listBox.Items)
{
- listBoxItem.Show(listBoxItem.Content.ToString().ToLower().Contains(e.Info.ToLower()));
- }
- }
-
- private void SearchBarControl_OnSearchStarted(object sender, FunctionEventArgs e)
- {
- if (e.Info == null) return;
-
- foreach (var listBoxItem in ListBoxControl.Items.OfType())
- {
- listBoxItem.Show(listBoxItem.Content.ToString().ToLower().Contains(e.Info.ToLower()));
+ var listBoxItem = listBox.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
+ listBoxItem?.Show(item.Name.ToLower().Contains(e.Info.ToLower()) ||
+ item.TargetCtlName.Replace("DemoCtl", "").ToLower().Contains(e.Info.ToLower()));
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/MainContent.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/MainContent.xaml
index efe7f50e..e4bacd27 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/MainContent.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/MainContent.xaml
@@ -1,20 +1,37 @@
-
-
-
-
-
-
-
-
+ xmlns:hc="https://handyorg.github.io/handycontrol"
+ xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
+ x:Class="HandyControlDemo.UserControl.MainContent">
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/MainContent.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Main/MainContent.xaml.cs
index 253c684e..47361439 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/MainContent.xaml.cs
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/MainContent.xaml.cs
@@ -2,6 +2,7 @@
using GalaSoft.MvvmLight.Messaging;
using HandyControl.Tools.Extension;
using HandyControlDemo.Data;
+using HandyControlDemo.ViewModel;
namespace HandyControlDemo.UserControl
@@ -13,6 +14,8 @@ namespace HandyControlDemo.UserControl
{
private bool _isFull;
+ private string _currentDemoKey;
+
public MainContent()
{
InitializeComponent();
@@ -43,5 +46,25 @@ namespace HandyControlDemo.UserControl
PresenterMain.Margin = new Thickness(0, 0, 0, 10);
}
}
+
+ private void DrawerCode_OnOpened(object sender, RoutedEventArgs e)
+ {
+ var typeKey = ViewModelLocator.Instance.Main.DemoInfoCurrent.Key;
+ var demoKey = ViewModelLocator.Instance.Main.DemoItemCurrent.TargetCtlName;
+ if (Equals(_currentDemoKey, demoKey)) return;
+ _currentDemoKey = demoKey;
+
+ if (ViewModelLocator.Instance.Main.SubContent is FrameworkElement demoCtl)
+ {
+ var xamlPath = $"UserControl/{typeKey}/{demoCtl.GetType().Name}.xaml";
+ var dc = demoCtl.DataContext;
+ var dcTypeName = dc.GetType().Name;
+ var vmPath = $"ViewModel/{dcTypeName}";
+
+ EditorXaml.Text = DemoHelper.GetCode(xamlPath);
+ EditorCs.Text = DemoHelper.GetCode($"{xamlPath}.cs");
+ EditorVm.Text = DemoHelper.GetCode($"{vmPath}.cs");
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/NoUserContent.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/NoUserContent.xaml
index 2f87318d..fc08029c 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/NoUserContent.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/NoUserContent.xaml
@@ -23,6 +23,11 @@
+
-
+
@@ -81,6 +121,12 @@
+
+
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 b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToggleButtonDemoCtl.xaml
index 34ec4516..a184c7ae 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToggleButtonDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/ToggleButtonDemoCtl.xaml
@@ -5,7 +5,7 @@
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
xmlns:hc="https://handyorg.github.io/handycontrol">
-
+
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/UserControl/Styles/TreeViewDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/TreeViewDemoCtl.xaml
index 088c6b16..606acf90 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/TreeViewDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/TreeViewDemoCtl.xaml
@@ -4,7 +4,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
Background="{DynamicResource RegionBrush}">
-
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Tools/EffectsDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/EffectsDemoCtl.xaml
new file mode 100644
index 00000000..649aef85
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/EffectsDemoCtl.xaml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Tools/EffectsDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/EffectsDemoCtl.xaml.cs
new file mode 100644
index 00000000..7f56b93f
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/EffectsDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class EffectsDemoCtl
+ {
+ public EffectsDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Tools/GeometryAnimationDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/GeometryAnimationDemoCtl.xaml
new file mode 100644
index 00000000..bce845a2
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/GeometryAnimationDemoCtl.xaml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Tools/GeometryAnimationDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/GeometryAnimationDemoCtl.xaml.cs
new file mode 100644
index 00000000..959bc541
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/GeometryAnimationDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class GeometryAnimationDemoCtl
+ {
+ public GeometryAnimationDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Tools/HatchBrushGeneratorDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/HatchBrushGeneratorDemoCtl.xaml
new file mode 100644
index 00000000..f13d884c
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/HatchBrushGeneratorDemoCtl.xaml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Tools/HatchBrushGeneratorDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/HatchBrushGeneratorDemoCtl.xaml.cs
new file mode 100644
index 00000000..c0b53b05
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/HatchBrushGeneratorDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class HatchBrushGeneratorDemoCtl
+ {
+ public HatchBrushGeneratorDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/ViewModel/Basic/ChatBoxViewModel.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/Basic/ChatBoxViewModel.cs
index 4bc00623..e19fd556 100644
--- a/src/Shared/HandyControlDemo_Shared/ViewModel/Basic/ChatBoxViewModel.cs
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/Basic/ChatBoxViewModel.cs
@@ -88,7 +88,7 @@ namespace HandyControlDemo.ViewModel
{
new ImageBrowser(new Uri(info.Enclosure.ToString()))
{
- Owner = VisualHelper.GetActiveWindow()
+ Owner = WindowHelper.GetActiveWindow()
}.Show();
}
else if (info.Type == ChatMessageType.Audio)
@@ -104,12 +104,12 @@ namespace HandyControlDemo.ViewModel
private void StartRecord()
{
- ExternDllHelper.MciSendString("set wave bitpersample 8", "", 0, 0);
- ExternDllHelper.MciSendString("set wave samplespersec 20000", "", 0, 0);
- ExternDllHelper.MciSendString("set wave channels 2", "", 0, 0);
- ExternDllHelper.MciSendString("set wave format tag pcm", "", 0, 0);
- ExternDllHelper.MciSendString("open new type WAVEAudio alias movie", "", 0, 0);
- ExternDllHelper.MciSendString("record movie", "", 0, 0);
+ Win32Helper.MciSendString("set wave bitpersample 8", "", 0, 0);
+ Win32Helper.MciSendString("set wave samplespersec 20000", "", 0, 0);
+ Win32Helper.MciSendString("set wave channels 2", "", 0, 0);
+ Win32Helper.MciSendString("set wave format tag pcm", "", 0, 0);
+ Win32Helper.MciSendString("open new type WAVEAudio alias movie", "", 0, 0);
+ Win32Helper.MciSendString("record movie", "", 0, 0);
_stopwatch.Reset();
_stopwatch.Start();
@@ -134,9 +134,10 @@ namespace HandyControlDemo.ViewModel
}
var cachePath = $"{AudioCachePath}\\{Guid.NewGuid().ToString()}";
- ExternDllHelper.MciSendString("stop movie", "", 0, 0);
- ExternDllHelper.MciSendString($"save movie {cachePath}", "", 0, 0);
- ExternDllHelper.MciSendString("close movie", "", 0, 0);
+ var cachePathWithQuotes = $"\"{cachePath}\"";
+ Win32Helper.MciSendString("stop movie", "", 0, 0);
+ Win32Helper.MciSendString($"save movie {cachePathWithQuotes}", "", 0, 0);
+ Win32Helper.MciSendString("close movie", "", 0, 0);
_stopwatch.Stop();
diff --git a/src/Shared/HandyControlDemo_Shared/ViewModel/Basic/InteractiveDialogViewModel.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/Basic/InteractiveDialogViewModel.cs
index 2406d7a3..d9a19626 100644
--- a/src/Shared/HandyControlDemo_Shared/ViewModel/Basic/InteractiveDialogViewModel.cs
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/Basic/InteractiveDialogViewModel.cs
@@ -7,7 +7,7 @@ using GalaSoft.MvvmLight.CommandWpf;
#endif
using HandyControl.Tools.Extension;
-namespace HandyControlDemo.ViewModel.Basic
+namespace HandyControlDemo.ViewModel
{
public class InteractiveDialogViewModel : ViewModelBase, IDialogResultable
{
diff --git a/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/BadgeDemoViewModel.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/BadgeDemoViewModel.cs
index ada4f4fe..5570cc4e 100644
--- a/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/BadgeDemoViewModel.cs
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/BadgeDemoViewModel.cs
@@ -6,7 +6,7 @@ using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.CommandWpf;
#endif
-namespace HandyControlDemo.ViewModel.Controls
+namespace HandyControlDemo.ViewModel
{
public class BadgeDemoViewModel : ViewModelBase
{
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/DialogDemoViewModel.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/DialogDemoViewModel.cs
index cb149c85..e3c1a08e 100644
--- a/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/DialogDemoViewModel.cs
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/DialogDemoViewModel.cs
@@ -11,7 +11,6 @@ using HandyControl.Controls;
using HandyControl.Tools.Extension;
using HandyControlDemo.Data;
using HandyControlDemo.UserControl;
-using HandyControlDemo.ViewModel.Basic;
using HandyControlDemo.Window;
namespace HandyControlDemo.ViewModel
diff --git a/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/GrowlDemoViewModel.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/GrowlDemoViewModel.cs
index c40bab23..2685093b 100644
--- a/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/GrowlDemoViewModel.cs
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/GrowlDemoViewModel.cs
@@ -25,6 +25,8 @@ namespace HandyControlDemo.ViewModel
_token = token;
}
+ #region Window
+
public RelayCommand InfoCmd => new Lazy(() =>
new RelayCommand(() => Growl.Info(Properties.Langs.Lang.GrowlInfo, _token))).Value;
@@ -47,14 +49,14 @@ namespace HandyControlDemo.ViewModel
public RelayCommand ErrorCmd => new Lazy(() =>
new RelayCommand(() => Growl.Error(Properties.Langs.Lang.GrowlError, _token))).Value;
- public RelayCommand AskCmd => new Lazy(() =>
+ public RelayCommand AskCmd => new Lazy(() =>
new RelayCommand(() => Growl.Ask(Properties.Langs.Lang.GrowlAsk, isConfirmed =>
{
Growl.Info(isConfirmed.ToString());
return true;
}, _token))).Value;
- public RelayCommand FatalCmd => new Lazy(() =>
+ public RelayCommand FatalCmd => new Lazy(() =>
new RelayCommand(() => Growl.Fatal(new GrowlInfo
{
Message = Properties.Langs.Lang.GrowlFatal,
@@ -63,7 +65,51 @@ namespace HandyControlDemo.ViewModel
}))).Value;
public RelayCommand ClearCmd => new Lazy(() =>
- new RelayCommand(() => Growl.Clear())).Value;
+ new RelayCommand(() => Growl.Clear(_token))).Value;
+
+ #endregion
+
+ #region Desktop
+
+ public RelayCommand InfoGlobalCmd => new Lazy(() =>
+ new RelayCommand(() => Growl.InfoGlobal(Properties.Langs.Lang.GrowlInfo))).Value;
+
+ public RelayCommand SuccessGlobalCmd => new Lazy(() =>
+ new RelayCommand(() => Growl.SuccessGlobal(Properties.Langs.Lang.GrowlSuccess))).Value;
+
+ public RelayCommand WarningGlobalCmd => new Lazy(() =>
+ new RelayCommand(() => Growl.WarningGlobal(new GrowlInfo
+ {
+ Message = Properties.Langs.Lang.GrowlWarning,
+ CancelStr = Properties.Langs.Lang.Ignore,
+ ActionBeforeClose = isConfirmed =>
+ {
+ Growl.InfoGlobal(isConfirmed.ToString());
+ return true;
+ }
+ }))).Value;
+
+ public RelayCommand ErrorGlobalCmd => new Lazy(() =>
+ new RelayCommand(() => Growl.ErrorGlobal(Properties.Langs.Lang.GrowlError))).Value;
+
+ public RelayCommand AskGlobalCmd => new Lazy(() =>
+ new RelayCommand(() => Growl.AskGlobal(Properties.Langs.Lang.GrowlAsk, isConfirmed =>
+ {
+ Growl.InfoGlobal(isConfirmed.ToString());
+ return true;
+ }))).Value;
+
+ public RelayCommand FatalGlobalCmd => new Lazy(() =>
+ new RelayCommand(() => Growl.FatalGlobal(new GrowlInfo
+ {
+ Message = Properties.Langs.Lang.GrowlFatal,
+ ShowDateTime = false
+ }))).Value;
+
+ public RelayCommand ClearGlobalCmd => new Lazy(() =>
+ new RelayCommand(Growl.ClearGlobal)).Value;
+
+ #endregion
public RelayCommand NewWindowCmd => new Lazy(() =>
new RelayCommand(() => new GrowlDemoWindow
diff --git a/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/NotificationDemoViewModel.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/NotificationDemoViewModel.cs
new file mode 100644
index 00000000..e5ed3be9
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/NotificationDemoViewModel.cs
@@ -0,0 +1,43 @@
+#if netle40
+using GalaSoft.MvvmLight.Command;
+#else
+using GalaSoft.MvvmLight.CommandWpf;
+# endif
+using System;
+using GalaSoft.MvvmLight;
+using HandyControl.Controls;
+using HandyControl.Data;
+using HandyControlDemo.UserControl;
+
+namespace HandyControlDemo.ViewModel
+{
+ public class NotificationDemoViewModel : ViewModelBase
+ {
+ public RelayCommand OpenCmd => new Lazy(() =>
+ new RelayCommand(() => Notification.Show(new AppNotification(), ShowAnimation, StaysOpen))).Value;
+
+ private ShowAnimation _showAnimation;
+
+ public ShowAnimation ShowAnimation
+ {
+ get => _showAnimation;
+#if netle40
+ set => Set(nameof(ShowAnimation) ,ref _showAnimation, value);
+#else
+ set => Set(ref _showAnimation, value);
+#endif
+ }
+
+ private bool _staysOpen = true;
+
+ public bool StaysOpen
+ {
+ get => _staysOpen;
+#if netle40
+ set => Set(nameof(StaysOpen) ,ref _staysOpen, value);
+#else
+ set => Set(ref _staysOpen, value);
+#endif
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/NotifyIconDemoViewModel.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/NotifyIconDemoViewModel.cs
index 9b7750d1..428371dd 100644
--- a/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/NotifyIconDemoViewModel.cs
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/NotifyIconDemoViewModel.cs
@@ -6,6 +6,7 @@ using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.CommandWpf;
# endif
using HandyControl.Controls;
+using HandyControl.Data;
using HandyControlDemo.Data;
namespace HandyControlDemo.ViewModel
@@ -16,6 +17,18 @@ namespace HandyControlDemo.ViewModel
private bool _reversed;
+ private string _content = "Hello~~~";
+
+ public string Content
+ {
+ get => _content;
+#if netle40
+ set => Set(nameof(Content), ref _content, value);
+#else
+ set => Set(ref _content, value);
+#endif
+ }
+
private bool _contextMenuIsShow;
public bool ContextMenuIsShow
@@ -87,6 +100,14 @@ namespace HandyControlDemo.ViewModel
public RelayCommand
-
+
diff --git a/src/Shared/HandyControlDemo_Shared/Window/NativeCommonWindow.xaml b/src/Shared/HandyControlDemo_Shared/Window/NativeCommonWindow.xaml
new file mode 100644
index 00000000..95ff3490
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/Window/NativeCommonWindow.xaml
@@ -0,0 +1,10 @@
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/Window/NativeCommonWindow.xaml.cs b/src/Shared/HandyControlDemo_Shared/Window/NativeCommonWindow.xaml.cs
new file mode 100644
index 00000000..3ffa3f70
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/Window/NativeCommonWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.Window
+{
+ public partial class NativeCommonWindow
+ {
+ public NativeCommonWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/Window/NavigationWindow.xaml b/src/Shared/HandyControlDemo_Shared/Window/NavigationWindow.xaml
new file mode 100644
index 00000000..afc42cf5
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/Window/NavigationWindow.xaml
@@ -0,0 +1,10 @@
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/Window/NavigationWindow.xaml.cs b/src/Shared/HandyControlDemo_Shared/Window/NavigationWindow.xaml.cs
new file mode 100644
index 00000000..3b3fcfd0
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/Window/NavigationWindow.xaml.cs
@@ -0,0 +1,56 @@
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using HandyControl.Tools.Extension;
+
+namespace HandyControlDemo.Window
+{
+ public partial class NavigationWindow
+ {
+ private readonly List _pageList;
+
+ public NavigationWindow()
+ {
+ InitializeComponent();
+
+ AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(Button_Click));
+
+ _pageList = new List();
+ for (var i = 0; i < 5; i++)
+ {
+ _pageList.Add(CreatePage(i));
+ }
+
+ Navigate(_pageList[0]);
+ }
+
+ private Page CreatePage(int index)
+ {
+ var indexStr = index.ToString();
+ var button = new Button
+ {
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ Content = indexStr,
+ Width = 320,
+ Tag = indexStr
+ };
+
+ return new Page
+ {
+ Title = indexStr,
+ Content = button
+ };
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ if (e.OriginalSource is Button button && button.Tag is string tag)
+ {
+ var index = tag.Value() + 1;
+ Navigate(index >= _pageList.Count ? _pageList[0] : _pageList[index]);
+ }
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/Window/NoNonClientAreaDragableWindow.xaml b/src/Shared/HandyControlDemo_Shared/Window/NoNonClientAreaDragableWindow.xaml
index 7a9199fe..39d0715f 100644
--- a/src/Shared/HandyControlDemo_Shared/Window/NoNonClientAreaDragableWindow.xaml
+++ b/src/Shared/HandyControlDemo_Shared/Window/NoNonClientAreaDragableWindow.xaml
@@ -8,7 +8,6 @@
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
ShowTitle="True"
- Style="{StaticResource WindowBlur}"
Icon="/HandyControlDemo;component/Resources/Img/icon.ico"
ShowNonClientArea="False"
Title="NoClientDragableWindow"
diff --git a/src/Shared/HandyControl_Shared/Collections/ManualObservableCollection!1.cs b/src/Shared/HandyControl_Shared/Collections/ManualObservableCollection!1.cs
new file mode 100644
index 00000000..39abfc7e
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Collections/ManualObservableCollection!1.cs
@@ -0,0 +1,191 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace HandyControl.Collections
+{
+ [Serializable]
+ public class ManualObservableCollection : Collection, INotifyCollectionChanged, INotifyPropertyChanged
+ {
+ private SimpleMonitor _monitor = new SimpleMonitor();
+
+ private const string CountString = "Count";
+
+ private const string IndexerName = "Item[]";
+
+ private bool _canNotify = true;
+
+ public bool CanNotify
+ {
+ get => _canNotify;
+ set
+ {
+ _canNotify = value;
+
+ if (value)
+ {
+ if (_oldCount != Count)
+ {
+ OnPropertyChanged(CountString);
+ }
+
+ OnPropertyChanged(IndexerName);
+ OnCollectionReset();
+ }
+ else
+ {
+ _oldCount = Count;
+ }
+ }
+ }
+
+ private int _oldCount;
+
+ public event NotifyCollectionChangedEventHandler CollectionChanged;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public ManualObservableCollection()
+ {
+
+ }
+
+ // ReSharper disable once AssignNullToNotNullAttribute
+ public ManualObservableCollection(List list) : base(list != null ? new List(list.Count) : list) => CopyFrom(list);
+
+ public ManualObservableCollection(IEnumerable collection)
+ {
+ if (collection == null) throw new ArgumentNullException(nameof(collection));
+ CopyFrom(collection);
+ }
+
+ private void CopyFrom(IEnumerable collection)
+ {
+ var items = Items;
+ if (collection != null)
+ {
+ using var enumerator = collection.GetEnumerator();
+ while (enumerator.MoveNext())
+ {
+ items.Add(enumerator.Current);
+ }
+ }
+ }
+
+ public void Move(int oldIndex, int newIndex) => MoveItem(oldIndex, newIndex);
+
+ protected override void ClearItems()
+ {
+ CheckReentrancy();
+ base.ClearItems();
+ OnPropertyChanged(CountString);
+ OnPropertyChanged(IndexerName);
+ OnCollectionReset();
+ }
+
+ protected override void RemoveItem(int index)
+ {
+ CheckReentrancy();
+ var removedItem = this[index];
+
+ base.RemoveItem(index);
+
+ OnPropertyChanged(CountString);
+ OnPropertyChanged(IndexerName);
+ OnCollectionChanged(NotifyCollectionChangedAction.Remove, removedItem, index);
+ }
+
+ protected override void InsertItem(int index, T item)
+ {
+ CheckReentrancy();
+ base.InsertItem(index, item);
+
+ OnPropertyChanged(CountString);
+ OnPropertyChanged(IndexerName);
+ OnCollectionChanged(NotifyCollectionChangedAction.Add, item, index);
+ }
+
+ protected override void SetItem(int index, T item)
+ {
+ CheckReentrancy();
+ var originalItem = this[index];
+ base.SetItem(index, item);
+
+ OnPropertyChanged(IndexerName);
+ OnCollectionChanged(NotifyCollectionChangedAction.Replace, originalItem, item, index);
+ }
+
+ protected virtual void MoveItem(int oldIndex, int newIndex)
+ {
+ CheckReentrancy();
+
+ var removedItem = this[oldIndex];
+
+ base.RemoveItem(oldIndex);
+ base.InsertItem(newIndex, removedItem);
+
+ OnPropertyChanged(IndexerName);
+ OnCollectionChanged(NotifyCollectionChangedAction.Move, removedItem, newIndex, oldIndex);
+ }
+
+ protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
+ {
+ if (!CanNotify || PropertyChanged == null) return;
+
+ PropertyChanged.Invoke(this, e);
+ }
+
+ protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
+ {
+ if (!CanNotify || CollectionChanged == null) return;
+
+ using (BlockReentrancy())
+ {
+ // ReSharper disable once PossibleNullReferenceException
+ CollectionChanged(this, e);
+ }
+ }
+
+ protected IDisposable BlockReentrancy()
+ {
+ _monitor.Enter();
+ return _monitor;
+ }
+
+ protected void CheckReentrancy()
+ {
+ if (_monitor.Busy && CollectionChanged != null && CollectionChanged.GetInvocationList().Length > 1)
+ {
+ throw new InvalidOperationException("ObservableCollectionReentrancyNotAllowed");
+ }
+ }
+
+ private void OnPropertyChanged(string propertyName) =>
+ OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
+
+ private void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index) =>
+ OnCollectionChanged(new NotifyCollectionChangedEventArgs(action, item, index));
+
+ private void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index, int oldIndex) =>
+ OnCollectionChanged(new NotifyCollectionChangedEventArgs(action, item, index, oldIndex));
+
+ private void OnCollectionChanged(NotifyCollectionChangedAction action, object oldItem, object newItem, int index) =>
+ OnCollectionChanged(new NotifyCollectionChangedEventArgs(action, newItem, oldItem, index));
+
+ private void OnCollectionReset() =>
+ OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
+
+ private class SimpleMonitor : IDisposable
+ {
+ public void Enter() => ++_busyCount;
+
+ public void Dispose() => --_busyCount;
+
+ public bool Busy => _busyCount > 0;
+
+ private int _busyCount;
+ }
+ }
+}
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/InfoElement.cs b/src/Shared/HandyControl_Shared/Controls/Attach/InfoElement.cs
index 654baae1..43b0ad00 100644
--- a/src/Shared/HandyControl_Shared/Controls/Attach/InfoElement.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Attach/InfoElement.cs
@@ -44,5 +44,29 @@ namespace HandyControl.Controls
public static void SetContentHeight(DependencyObject element, double value) => element.SetValue(ContentHeightProperty, value);
public static double GetContentHeight(DependencyObject element) => (double)element.GetValue(ContentHeightProperty);
+
+ ///
+ /// 最小内容高度
+ ///
+ public static readonly DependencyProperty MinContentHeightProperty = DependencyProperty.RegisterAttached(
+ "MinContentHeight", typeof(double), typeof(InfoElement), new PropertyMetadata(30.0));
+
+ public static void SetMinContentHeight(DependencyObject element, double value)
+ => element.SetValue(MinContentHeightProperty, value);
+
+ public static double GetMinContentHeight(DependencyObject element)
+ => (double) element.GetValue(MinContentHeightProperty);
+
+ ///
+ /// 最大内容高度
+ ///
+ public static readonly DependencyProperty MaxContentHeightProperty = DependencyProperty.RegisterAttached(
+ "MaxContentHeight", typeof(double), typeof(InfoElement), new PropertyMetadata(double.PositiveInfinity));
+
+ public static void SetMaxContentHeight(DependencyObject element, double value)
+ => element.SetValue(MaxContentHeightProperty, value);
+
+ public static double GetMaxContentHeight(DependencyObject element)
+ => (double) element.GetValue(MaxContentHeightProperty);
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Attach/TextBlockAttach.cs b/src/Shared/HandyControl_Shared/Controls/Attach/TextBlockAttach.cs
new file mode 100644
index 00000000..9311da19
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Attach/TextBlockAttach.cs
@@ -0,0 +1,53 @@
+using System.Windows;
+using System.Windows.Controls;
+using HandyControl.Data;
+
+namespace HandyControl.Controls
+{
+ public class TextBlockAttach
+ {
+ public static readonly DependencyProperty AutoTooltipProperty = DependencyProperty.RegisterAttached(
+ "AutoTooltip", typeof(bool), typeof(TextBlockAttach), new PropertyMetadata(ValueBoxes.FalseBox, OnAutoTooltipChanged));
+
+ private static void OnAutoTooltipChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is TextBlock ctl)
+ {
+ if ((bool)e.NewValue)
+ {
+ ctl.TextTrimming = TextTrimming.WordEllipsis;
+ UpdateTooltip(ctl);
+ ctl.SizeChanged += TextBlock_SizeChanged;
+ }
+ else
+ {
+ ctl.ClearValue(TextBlock.TextTrimmingProperty);
+ ctl.SizeChanged -= TextBlock_SizeChanged;
+ }
+ }
+ }
+
+ public static void SetAutoTooltip(DependencyObject element, bool value)
+ => element.SetValue(AutoTooltipProperty, value);
+
+ public static bool GetAutoTooltip(DependencyObject element)
+ => (bool) element.GetValue(AutoTooltipProperty);
+
+ private static void TextBlock_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ if (sender is TextBlock textBlock)
+ {
+ UpdateTooltip(textBlock);
+ }
+ }
+
+ private static void UpdateTooltip(TextBlock textBlock)
+ {
+ textBlock.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
+ var width = textBlock.DesiredSize.Width - textBlock.Margin.Left - textBlock.Margin.Right;
+
+ ToolTipService.SetToolTip(textBlock,
+ textBlock.RenderSize.Width > width || textBlock.ActualWidth < width ? textBlock.Text : null);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Attach/TipElement.cs b/src/Shared/HandyControl_Shared/Controls/Attach/TipElement.cs
index 5fa5481f..62f12396 100644
--- a/src/Shared/HandyControl_Shared/Controls/Attach/TipElement.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Attach/TipElement.cs
@@ -13,10 +13,19 @@ namespace HandyControl.Controls
public static Visibility GetVisibility(DependencyObject element) => (Visibility) element.GetValue(VisibilityProperty);
public static readonly DependencyProperty PlacementProperty = DependencyProperty.RegisterAttached(
- "Placement", typeof(TipPlacement), typeof(TipElement), new PropertyMetadata(default(TipPlacement)));
+ "Placement", typeof(PlacementType), typeof(TipElement), new PropertyMetadata(default(PlacementType)));
- public static void SetPlacement(DependencyObject element, TipPlacement value) => element.SetValue(PlacementProperty, value);
+ public static void SetPlacement(DependencyObject element, PlacementType value) => element.SetValue(PlacementProperty, value);
- public static TipPlacement GetPlacement(DependencyObject element) => (TipPlacement) element.GetValue(PlacementProperty);
+ public static PlacementType GetPlacement(DependencyObject element) => (PlacementType) element.GetValue(PlacementProperty);
+
+ public static readonly DependencyProperty StringFormatProperty = DependencyProperty.RegisterAttached(
+ "StringFormat", typeof(string), typeof(TipElement), new PropertyMetadata("#0.0"));
+
+ public static void SetStringFormat(DependencyObject element, string value)
+ => element.SetValue(StringFormatProperty, value);
+
+ public static string GetStringFormat(DependencyObject element)
+ => (string) element.GetValue(StringFormatProperty);
}
}
\ 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 99909ec9..dd6a8db5 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 = InteropMethods.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/Base/AdornerElement.cs b/src/Shared/HandyControl_Shared/Controls/Base/AdornerElement.cs
new file mode 100644
index 00000000..c3fa3241
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Base/AdornerElement.cs
@@ -0,0 +1,87 @@
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Controls;
+using HandyControl.Data;
+
+namespace HandyControl.Controls
+{
+ public abstract class AdornerElement : Control, IDisposable
+ {
+ protected FrameworkElement ElementTarget { get; set; }
+
+ public static readonly DependencyProperty TargetProperty = DependencyProperty.Register(
+ "Target", typeof(FrameworkElement), typeof(AdornerElement), new PropertyMetadata(default(FrameworkElement), OnTargetChanged));
+
+ private static void OnTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var ctl = (AdornerElement)d;
+ ctl.OnTargetChanged(ctl.ElementTarget, false);
+ ctl.OnTargetChanged((FrameworkElement)e.NewValue, true);
+ }
+
+ [Bindable(true), Category("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public FrameworkElement Target
+ {
+ get => (FrameworkElement) GetValue(TargetProperty);
+ set => SetValue(TargetProperty, value);
+ }
+
+ public static readonly DependencyProperty InstanceProperty = DependencyProperty.RegisterAttached(
+ "Instance", typeof(AdornerElement), typeof(AdornerElement), new PropertyMetadata(default(AdornerElement), OnInstanceChanged));
+
+ private static void OnInstanceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (!(d is FrameworkElement target)) return;
+ var element = (AdornerElement)e.NewValue;
+ element.OnInstanceChanged(target);
+ }
+
+ protected virtual void OnInstanceChanged(FrameworkElement target) => Target = target;
+
+ public static void SetInstance(DependencyObject element, AdornerElement value)
+ => element.SetValue(InstanceProperty, value);
+
+ public static AdornerElement GetInstance(DependencyObject element)
+ => (AdornerElement) element.GetValue(InstanceProperty);
+
+ public static readonly DependencyProperty IsInstanceProperty = DependencyProperty.RegisterAttached(
+ "IsInstance", typeof(bool), typeof(AdornerElement), new PropertyMetadata(ValueBoxes.TrueBox));
+
+ public static void SetIsInstance(DependencyObject element, bool value)
+ => element.SetValue(IsInstanceProperty, value);
+
+ public static bool GetIsInstance(DependencyObject element)
+ => (bool) element.GetValue(IsInstanceProperty);
+
+ protected virtual void OnTargetChanged(FrameworkElement element, bool isNew)
+ {
+ if (element == null) return;
+
+ if (!isNew)
+ {
+ element.Unloaded -= TargetElement_Unloaded;
+ ElementTarget = null;
+ }
+ else
+ {
+ element.Unloaded += TargetElement_Unloaded;
+ ElementTarget = element;
+ }
+ }
+
+ private void TargetElement_Unloaded(object sender, RoutedEventArgs e)
+ {
+ if (sender is FrameworkElement element)
+ {
+ element.Unloaded -= TargetElement_Unloaded;
+ Dispose();
+ }
+ }
+
+ protected abstract void Dispose();
+
+ void IDisposable.Dispose() => Dispose();
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Controls/Block/FloatingBlock.cs b/src/Shared/HandyControl_Shared/Controls/Block/FloatingBlock.cs
new file mode 100644
index 00000000..3a7287bb
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Block/FloatingBlock.cs
@@ -0,0 +1,195 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using HandyControl.Data;
+using HandyControl.Interactivity;
+using HandyControl.Tools;
+
+namespace HandyControl.Controls
+{
+ public class FloatingBlock : Control
+ {
+ public static readonly DependencyProperty ToXProperty = DependencyProperty.RegisterAttached(
+ "ToX", typeof(double), typeof(FloatingBlock), new PropertyMetadata(ValueBoxes.Double0Box));
+
+ public static void SetToX(DependencyObject element, double value)
+ => element.SetValue(ToXProperty, value);
+
+ public static double GetToX(DependencyObject element)
+ => (double) element.GetValue(ToXProperty);
+
+ public static readonly DependencyProperty ToYProperty = DependencyProperty.RegisterAttached(
+ "ToY", typeof(double), typeof(FloatingBlock), new PropertyMetadata(-100.0));
+
+ public static void SetToY(DependencyObject element, double value)
+ => element.SetValue(ToYProperty, value);
+
+ public static double GetToY(DependencyObject element)
+ => (double)element.GetValue(ToYProperty);
+
+ public static readonly DependencyProperty DurationProperty = DependencyProperty.RegisterAttached(
+ "Duration", typeof(Duration), typeof(FloatingBlock), new PropertyMetadata(new Duration(TimeSpan.FromSeconds(2))));
+
+ public static void SetDuration(DependencyObject element, Duration value)
+ => element.SetValue(DurationProperty, value);
+
+ public static Duration GetDuration(DependencyObject element)
+ => (Duration) element.GetValue(DurationProperty);
+
+ public static readonly DependencyProperty HorizontalOffsetProperty = DependencyProperty.RegisterAttached(
+ "HorizontalOffset", typeof(double), typeof(FloatingBlock), new PropertyMetadata(ValueBoxes.Double0Box));
+
+ public static void SetHorizontalOffset(DependencyObject element, double value)
+ => element.SetValue(HorizontalOffsetProperty, value);
+
+ public static double GetHorizontalOffset(DependencyObject element)
+ => (double) element.GetValue(HorizontalOffsetProperty);
+
+ public static readonly DependencyProperty VerticalOffsetProperty = DependencyProperty.RegisterAttached(
+ "VerticalOffset", typeof(double), typeof(FloatingBlock), new PropertyMetadata(ValueBoxes.Double0Box));
+
+ public static void SetVerticalOffset(DependencyObject element, double value)
+ => element.SetValue(VerticalOffsetProperty, value);
+
+ public static double GetVerticalOffset(DependencyObject element)
+ => (double) element.GetValue(VerticalOffsetProperty);
+
+ public static readonly DependencyProperty ContentTemplateProperty = DependencyProperty.RegisterAttached(
+ "ContentTemplate", typeof(DataTemplate), typeof(FloatingBlock), new PropertyMetadata(default(DataTemplate), OnDataChanged));
+
+ public static void SetContentTemplate(DependencyObject element, DataTemplate value)
+ => element.SetValue(ContentTemplateProperty, value);
+
+ public static DataTemplate GetContentTemplate(DependencyObject element)
+ => (DataTemplate) element.GetValue(ContentTemplateProperty);
+
+ public DataTemplate ContentTemplate
+ {
+ get => (DataTemplate)GetValue(ContentTemplateProperty);
+ set => SetValue(ContentTemplateProperty, value);
+ }
+
+ private static readonly DependencyProperty ReadyToFloatProperty = DependencyProperty.RegisterAttached(
+ "ReadyToFloat", typeof(bool), typeof(FloatingBlock), new PropertyMetadata(ValueBoxes.FalseBox));
+
+ private static void SetReadyToFloat(DependencyObject element, bool value)
+ => element.SetValue(ReadyToFloatProperty, value);
+
+ private static bool GetReadyToFloat(DependencyObject element)
+ => (bool)element.GetValue(ReadyToFloatProperty);
+
+ public static readonly DependencyProperty ContentProperty = DependencyProperty.RegisterAttached(
+ "Content", typeof(object), typeof(FloatingBlock), new PropertyMetadata(default, OnDataChanged));
+
+ public static void SetContent(DependencyObject element, object value)
+ => element.SetValue(ContentProperty, value);
+
+ public static object GetContent(DependencyObject element)
+ => element.GetValue(ContentProperty);
+
+ public object Content
+ {
+ get => GetValue(ContentProperty);
+ set => SetValue(ContentProperty, value);
+ }
+
+ private static void OnDataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (!(d is UIElement target)) return;
+
+ target.PreviewMouseLeftButtonDown -= Target_PreviewMouseLeftButtonDown;
+ target.PreviewMouseLeftButtonUp -= Target_PreviewMouseLeftButtonUp;
+
+ if (e.NewValue != null)
+ {
+ target.PreviewMouseLeftButtonDown += Target_PreviewMouseLeftButtonDown;
+ target.PreviewMouseLeftButtonUp += Target_PreviewMouseLeftButtonUp;
+ }
+ }
+
+ private static void Target_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) => SetReadyToFloat(sender as DependencyObject, true);
+
+ private static void Target_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+ {
+ if (sender is UIElement element && GetReadyToFloat(element))
+ {
+ var layer = AdornerLayer.GetAdornerLayer(element);
+ if (layer != null)
+ {
+ var adorner = new AdornerContainer(layer)
+ {
+ IsHitTestVisible = false
+ };
+ var child = CreateBlock(element, adorner);
+ adorner.Child = child;
+
+ layer.Add(adorner);
+ }
+ SetReadyToFloat(element, false);
+ }
+ }
+
+ private static FloatingBlock CreateBlock(Visual element, AdornerContainer adorner)
+ {
+ var p = Mouse.GetPosition(adorner.AdornedElement);
+ var transform = new TranslateTransform
+ {
+ X = p.X + GetHorizontalOffset(element),
+ Y = p.Y + GetVerticalOffset(element)
+ };
+
+ var block = new FloatingBlock
+ {
+ Content = GetContent(element),
+ ContentTemplate = GetContentTemplate(element),
+ RenderTransform = new TransformGroup
+ {
+ Children =
+ {
+ transform
+ }
+ }
+ };
+
+ var milliseconds = GetDuration(element).TimeSpan.TotalMilliseconds;
+
+ var animationX = AnimationHelper.CreateAnimation(GetToX(element) + transform.X, milliseconds);
+ Storyboard.SetTargetProperty(animationX, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)"));
+ Storyboard.SetTarget(animationX, block);
+
+ var animationY = AnimationHelper.CreateAnimation(GetToY(element) + transform.Y, milliseconds);
+ Storyboard.SetTargetProperty(animationY, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)"));
+ Storyboard.SetTarget(animationY, block);
+
+ var animationOpacity = AnimationHelper.CreateAnimation(0, milliseconds);
+ Storyboard.SetTargetProperty(animationOpacity, new PropertyPath("Opacity"));
+ Storyboard.SetTarget(animationOpacity, block);
+
+ var storyboard = new Storyboard();
+ storyboard.Completed += (s, e) =>
+ {
+ var layer = AdornerLayer.GetAdornerLayer(element);
+ if (layer != null)
+ {
+ layer.Remove(adorner);
+ }
+ else if (adorner.Parent is AdornerLayer parent)
+ {
+ parent.Remove(adorner);
+ }
+
+ adorner.Child = null;
+ };
+ storyboard.Children.Add(animationX);
+ storyboard.Children.Add(animationY);
+ storyboard.Children.Add(animationOpacity);
+ storyboard.Begin();
+
+ return block;
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Controls/Block/RunningBlock.cs b/src/Shared/HandyControl_Shared/Controls/Block/RunningBlock.cs
new file mode 100644
index 00000000..39bb9a1a
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Block/RunningBlock.cs
@@ -0,0 +1,172 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using HandyControl.Data;
+
+namespace HandyControl.Controls
+{
+ [TemplatePart(Name = ElementContent, Type = typeof(FrameworkElement))]
+ [TemplatePart(Name = ElementPanel, Type = typeof(Panel))]
+ public class RunningBlock : ContentControl
+ {
+ private const string ElementContent = "PART_ContentElement";
+
+ private const string ElementPanel = "PART_Panel";
+
+ protected Storyboard _storyboard;
+
+ private FrameworkElement _elementContent;
+
+ private FrameworkElement _elementPanel;
+
+ public override void OnApplyTemplate()
+ {
+ base.OnApplyTemplate();
+
+ _elementContent = GetTemplateChild(ElementContent) as FrameworkElement;
+ _elementPanel = GetTemplateChild(ElementPanel) as Panel;
+ }
+
+ public static readonly DependencyProperty RunawayProperty = DependencyProperty.Register(
+ "Runaway", typeof(bool), typeof(RunningBlock), new FrameworkPropertyMetadata(ValueBoxes.TrueBox, FrameworkPropertyMetadataOptions.AffectsRender));
+
+ public bool Runaway
+ {
+ get => (bool) GetValue(RunawayProperty);
+ set => SetValue(RunawayProperty, value);
+ }
+
+ public static readonly DependencyProperty AutoRunProperty = DependencyProperty.Register(
+ "AutoRun", typeof(bool), typeof(RunningBlock), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));
+
+ public bool AutoRun
+ {
+ get => (bool) GetValue(AutoRunProperty);
+ set => SetValue(AutoRunProperty, value);
+ }
+
+ public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
+ "Orientation", typeof(Orientation), typeof(RunningBlock), new FrameworkPropertyMetadata(default(Orientation), FrameworkPropertyMetadataOptions.AffectsRender));
+
+ public Orientation Orientation
+ {
+ get => (Orientation) GetValue(OrientationProperty);
+ set => SetValue(OrientationProperty, value);
+ }
+
+ public static readonly DependencyProperty DurationProperty = DependencyProperty.Register(
+ "Duration", typeof(Duration), typeof(RunningBlock), new FrameworkPropertyMetadata(new Duration(TimeSpan.FromSeconds(5)), FrameworkPropertyMetadataOptions.AffectsRender));
+
+ public Duration Duration
+ {
+ get => (Duration) GetValue(DurationProperty);
+ set => SetValue(DurationProperty, value);
+ }
+
+ public static readonly DependencyProperty IsRunningProperty = DependencyProperty.Register(
+ "IsRunning", typeof(bool), typeof(RunningBlock), new PropertyMetadata(ValueBoxes.TrueBox, (o, args) =>
+ {
+ var ctl = (RunningBlock)o;
+ var v = (bool)args.NewValue;
+ if (v)
+ {
+ ctl._storyboard?.Resume();
+ }
+ else
+ {
+ ctl._storyboard?.Pause();
+ }
+ }));
+
+ public bool IsRunning
+ {
+ get => (bool) GetValue(IsRunningProperty);
+ set => SetValue(IsRunningProperty, value);
+ }
+
+ public static readonly DependencyProperty AutoReverseProperty = DependencyProperty.Register(
+ "AutoReverse", typeof(bool), typeof(RunningBlock), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));
+
+ public bool AutoReverse
+ {
+ get => (bool) GetValue(AutoReverseProperty);
+ set => SetValue(AutoReverseProperty, value);
+ }
+
+ private void UpdateContent()
+ {
+ if (_elementContent == null || _elementPanel == null) return;
+
+ _storyboard?.Stop();
+
+ _elementPanel.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
+ _elementPanel.Width = _elementPanel.DesiredSize.Width;
+ _elementPanel.Height = _elementPanel.DesiredSize.Height;
+
+ double from;
+ double to;
+ PropertyPath propertyPath;
+
+ if (Orientation == Orientation.Horizontal)
+ {
+ if (AutoRun && _elementPanel.Width < ActualWidth)
+ {
+ return;
+ }
+
+ if (Runaway)
+ {
+ from = -_elementPanel.Width;
+ to = ActualWidth;
+ }
+ else
+ {
+ from = 0;
+ to = ActualWidth - _elementPanel.Width;
+ SetCurrentValue(AutoReverseProperty, ValueBoxes.TrueBox);
+ }
+ propertyPath = new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)");
+ }
+ else
+ {
+ if (AutoRun && _elementPanel.Height < ActualHeight)
+ {
+ return;
+ }
+
+ if (Runaway)
+ {
+ from = -_elementPanel.Height;
+ to = ActualHeight;
+ }
+ else
+ {
+ from = 0;
+ to = ActualHeight - _elementPanel.Height;
+ SetCurrentValue(AutoReverseProperty, ValueBoxes.TrueBox);
+ }
+ propertyPath = new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)");
+ }
+
+ var animation = new DoubleAnimation(from, to, Duration)
+ {
+ RepeatBehavior = RepeatBehavior.Forever,
+ AutoReverse = AutoReverse
+ };
+ Storyboard.SetTargetProperty(animation, propertyPath);
+ Storyboard.SetTarget(animation, _elementContent);
+
+ _storyboard = new Storyboard();
+ _storyboard.Children.Add(animation);
+ _storyboard.Begin();
+ }
+
+ protected override void OnRender(DrawingContext drawingContext)
+ {
+ base.OnRender(drawingContext);
+ UpdateContent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/ToggleBlock.cs b/src/Shared/HandyControl_Shared/Controls/Block/ToggleBlock.cs
similarity index 100%
rename from src/Shared/HandyControl_Shared/Controls/Other/ToggleBlock.cs
rename to src/Shared/HandyControl_Shared/Controls/Block/ToggleBlock.cs
diff --git a/src/Shared/HandyControl_Shared/Controls/Button/SplitButton.cs b/src/Shared/HandyControl_Shared/Controls/Button/SplitButton.cs
new file mode 100644
index 00000000..f5e3767c
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Button/SplitButton.cs
@@ -0,0 +1,81 @@
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using HandyControl.Data;
+using HandyControl.Data.Enum;
+
+namespace HandyControl.Controls
+{
+ public class SplitButton : ButtonBase
+ {
+ public static readonly DependencyProperty HitModeProperty = DependencyProperty.Register(
+ "HitMode", typeof(HitMode), typeof(SplitButton), new PropertyMetadata(default(HitMode)));
+
+ public HitMode HitMode
+ {
+ get => (HitMode) GetValue(HitModeProperty);
+ set => SetValue(HitModeProperty, value);
+ }
+
+ public static readonly DependencyProperty MaxDropDownHeightProperty = DependencyProperty.Register(
+ "MaxDropDownHeight", typeof(double), typeof(SplitButton), new PropertyMetadata(SystemParameters.PrimaryScreenHeight / 3.0));
+
+ public double MaxDropDownHeight
+ {
+ get => (double) GetValue(MaxDropDownHeightProperty);
+ set => SetValue(MaxDropDownHeightProperty, value);
+ }
+
+ public static readonly DependencyProperty IsDropDownOpenProperty = DependencyProperty.Register(
+ "IsDropDownOpen", typeof(bool), typeof(SplitButton), new PropertyMetadata(ValueBoxes.FalseBox));
+
+ public bool IsDropDownOpen
+ {
+ get => (bool) GetValue(IsDropDownOpenProperty);
+ set => SetValue(IsDropDownOpenProperty, value);
+ }
+
+ public static readonly DependencyProperty DropDownContentProperty = DependencyProperty.Register(
+ "DropDownContent", typeof(object), typeof(SplitButton), new PropertyMetadata(default(object)));
+
+ public object DropDownContent
+ {
+ get => GetValue(DropDownContentProperty);
+ set => SetValue(DropDownContentProperty, value);
+ }
+
+ public SplitButton()
+ {
+ AddHandler(MenuItem.ClickEvent, new RoutedEventHandler(ItemsOnClick));
+ }
+
+ private void ItemsOnClick(object sender, RoutedEventArgs e)
+ {
+ if (e.OriginalSource is MenuItem)
+ {
+ SetCurrentValue(IsDropDownOpenProperty, ValueBoxes.FalseBox);
+ }
+ }
+
+ protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
+ {
+ base.OnPreviewMouseLeftButtonDown(e);
+
+ if (HitMode == HitMode.Hover)
+ {
+ e.Handled = true;
+ }
+ }
+
+ protected override void OnMouseEnter(MouseEventArgs e)
+ {
+ base.OnMouseEnter(e);
+
+ if (HitMode == HitMode.Hover)
+ {
+ SetCurrentValue(IsDropDownOpenProperty, ValueBoxes.TrueBox);
+ }
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Controls/ColorPicker/ColorDropper.cs b/src/Shared/HandyControl_Shared/Controls/ColorPicker/ColorDropper.cs
index dc9ecf92..96d9c355 100644
--- a/src/Shared/HandyControl_Shared/Controls/ColorPicker/ColorDropper.cs
+++ b/src/Shared/HandyControl_Shared/Controls/ColorPicker/ColorDropper.cs
@@ -60,7 +60,7 @@ namespace HandyControl.Controls
if (!_colorPicker.IsMouseOver && window.IsMouseOver)
{
UpdateCursor(true);
- if (e.Message == MouseHookMessageType.LeftButtonDown)
+ if (e.MessageType == MouseHookMessageType.LeftButtonDown)
{
var brush = new SolidColorBrush(GetColorAt(e.Point.X, e.Point.Y));
_colorPicker.SelectedBrush = brush;
@@ -96,10 +96,10 @@ namespace HandyControl.Controls
public static Color GetColorAt(int x, int y)
{
- var desk = UnsafeNativeMethods.GetDesktopWindow();
- var dc = UnsafeNativeMethods.GetWindowDC(desk);
- var a = (int)UnsafeNativeMethods.GetPixel(dc, x, y);
- UnsafeNativeMethods.ReleaseDC(desk, dc);
+ var desk = InteropMethods.GetDesktopWindow();
+ var dc = InteropMethods.GetWindowDC(desk);
+ var a = (int)InteropMethods.GetPixel(dc, x, y);
+ InteropMethods.ReleaseDC(desk, dc);
return Color.FromArgb(255, (byte) ((a >> 0) & 0xff), (byte) ((a >> 8) & 0xff), (byte) ((a >> 16) & 0xff));
}
}
diff --git a/src/Shared/HandyControl_Shared/Controls/ColorPicker/ColorPicker.cs b/src/Shared/HandyControl_Shared/Controls/ColorPicker/ColorPicker.cs
index a3106db3..2d1bfd82 100644
--- a/src/Shared/HandyControl_Shared/Controls/ColorPicker/ColorPicker.cs
+++ b/src/Shared/HandyControl_Shared/Controls/ColorPicker/ColorPicker.cs
@@ -434,6 +434,7 @@ namespace HandyControl.Controls
///
private void Init()
{
+ if (_panelColor == null) return;
UpdateStatus(SelectedBrush.Color);
_panelColor.Children.Clear();
foreach (var item in _colorPresetList)
diff --git a/src/Shared/HandyControl_Shared/Controls/Cover/CoverView/CoverView.cs b/src/Shared/HandyControl_Shared/Controls/Cover/CoverView/CoverView.cs
index 96c8bf46..f1551909 100644
--- a/src/Shared/HandyControl_Shared/Controls/Cover/CoverView/CoverView.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Cover/CoverView/CoverView.cs
@@ -223,7 +223,7 @@ namespace HandyControl.Controls
{
ItemsHost.Children.Remove(_viewContent);
}
- var total = Items.Count + 1;
+ var total = _entryDic.Count + 1;
var totalRow = total / Groups + (total % Groups > 0 ? 1 : 0);
if (total <= Groups)
{
@@ -359,9 +359,9 @@ namespace HandyControl.Controls
private void GenerateIndex()
{
var index = 0;
- foreach (var item in Items)
+ foreach (var item in _entryDic.Values)
{
- _entryDic[item].Index = index++;
+ item.Index = index++;
}
}
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/Growl.cs b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs
similarity index 63%
rename from src/Shared/HandyControl_Shared/Controls/Other/Growl.cs
rename to src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs
index 789fb7c3..678dc5be 100644
--- a/src/Shared/HandyControl_Shared/Controls/Other/Growl.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs
@@ -31,6 +31,8 @@ namespace HandyControl.Controls
#region Data
+ private static GrowlWindow GrowlWindow;
+
private Panel _panelMore;
private Grid _gridMain;
@@ -276,7 +278,7 @@ namespace HandyControl.Controls
}
_tickCount++;
- if (_tickCount >= _waitTime) Close();
+ if (_tickCount >= _waitTime) Close(true);
};
_timerClose.Start();
}
@@ -293,6 +295,8 @@ namespace HandyControl.Controls
private static void InitGrowlPanel(Panel panel)
{
+ if (panel == null) return;
+
var menuItem = new MenuItem
{
Header = Properties.Langs.Lang.Clear
@@ -317,10 +321,8 @@ namespace HandyControl.Controls
private void Update()
{
- if (ActionBeforeClose != null)
+ if (Type == InfoType.Ask)
{
- _staysOpen = true;
- _showCloseButton = false;
_panelMore.IsEnabled = true;
_panelMore.Show();
}
@@ -334,6 +336,61 @@ namespace HandyControl.Controls
if (!_staysOpen) StartTimer();
}
+ private static void ShowGlobal(GrowlInfo growlInfo)
+ {
+ if (GrowlWindow == null)
+ {
+ GrowlWindow = new GrowlWindow();
+ GrowlWindow.Show();
+ InitGrowlPanel(GrowlWindow.GrowlPanel);
+ GrowlWindow.Init();
+ }
+
+ GrowlWindow.Show(true);
+
+#if netle40
+ Application.Current.Dispatcher?.Invoke(new Action(() =>
+ {
+ var ctl = new Growl
+ {
+ Message = growlInfo.Message,
+ Time = DateTime.Now,
+ Icon = ResourceHelper.GetResource(growlInfo.IconKey),
+ IconBrush = ResourceHelper.GetResource(growlInfo.IconBrushKey),
+ _showCloseButton = growlInfo.ShowCloseButton,
+ ActionBeforeClose = growlInfo.ActionBeforeClose,
+ _staysOpen = growlInfo.StaysOpen,
+ ShowDateTime = growlInfo.ShowDateTime,
+ ConfirmStr = growlInfo.ConfirmStr,
+ CancelStr = growlInfo.CancelStr,
+ Type = growlInfo.Type,
+ _waitTime = Math.Max(growlInfo.WaitTime, 2)
+ };
+ GrowlWindow.GrowlPanel.Children.Insert(0, ctl);
+ }));
+#else
+ Application.Current.Dispatcher?.Invoke(() =>
+ {
+ var ctl = new Growl
+ {
+ Message = growlInfo.Message,
+ Time = DateTime.Now,
+ Icon = ResourceHelper.GetResource(growlInfo.IconKey),
+ IconBrush = ResourceHelper.GetResource(growlInfo.IconBrushKey),
+ _showCloseButton = growlInfo.ShowCloseButton,
+ ActionBeforeClose = growlInfo.ActionBeforeClose,
+ _staysOpen = growlInfo.StaysOpen,
+ ShowDateTime = growlInfo.ShowDateTime,
+ ConfirmStr = growlInfo.ConfirmStr,
+ CancelStr = growlInfo.CancelStr,
+ Type = growlInfo.Type,
+ _waitTime = Math.Max(growlInfo.WaitTime, 2)
+ };
+ GrowlWindow.GrowlPanel.Children.Insert(0, ctl);
+ });
+#endif
+ }
+
///
/// 显示信息
///
@@ -341,7 +398,7 @@ namespace HandyControl.Controls
private static void Show(GrowlInfo growlInfo)
{
#if netle40
- Application.Current.Dispatcher.Invoke(new Action(() =>
+ Application.Current.Dispatcher?.Invoke(new Action(() =>
{
var ctl = new Growl
{
@@ -371,7 +428,7 @@ namespace HandyControl.Controls
}
}));
#else
- Application.Current.Dispatcher.Invoke(() =>
+ Application.Current.Dispatcher?.Invoke(() =>
{
var ctl = new Growl
{
@@ -403,6 +460,96 @@ namespace HandyControl.Controls
#endif
}
+ private static void InitGrowlInfo(ref GrowlInfo growlInfo, InfoType infoType)
+ {
+ if (growlInfo == null) throw new ArgumentNullException(nameof(growlInfo));
+ growlInfo.Type = infoType;
+
+ switch (infoType)
+ {
+ case InfoType.Success:
+ if (!growlInfo.IsCustom)
+ {
+ growlInfo.IconKey = ResourceToken.SuccessGeometry;
+ growlInfo.IconBrushKey = ResourceToken.SuccessBrush;
+ }
+ else
+ {
+ growlInfo.IconKey ??= ResourceToken.SuccessGeometry;
+ growlInfo.IconBrushKey ??= ResourceToken.SuccessBrush;
+ }
+ break;
+ case InfoType.Info:
+ if (!growlInfo.IsCustom)
+ {
+ growlInfo.IconKey = ResourceToken.InfoGeometry;
+ growlInfo.IconBrushKey = ResourceToken.InfoBrush;
+ }
+ else
+ {
+ growlInfo.IconKey ??= ResourceToken.InfoGeometry;
+ growlInfo.IconBrushKey ??= ResourceToken.InfoBrush;
+ }
+ break;
+ case InfoType.Warning:
+ if (!growlInfo.IsCustom)
+ {
+ growlInfo.IconKey = ResourceToken.WarningGeometry;
+ growlInfo.IconBrushKey = ResourceToken.WarningBrush;
+ }
+ else
+ {
+ growlInfo.IconKey ??= ResourceToken.WarningGeometry;
+ growlInfo.IconBrushKey ??= ResourceToken.WarningBrush;
+ }
+ break;
+ case InfoType.Error:
+ if (!growlInfo.IsCustom)
+ {
+ growlInfo.IconKey = ResourceToken.ErrorGeometry;
+ growlInfo.IconBrushKey = ResourceToken.DangerBrush;
+ growlInfo.StaysOpen = true;
+ }
+ else
+ {
+ growlInfo.IconKey ??= ResourceToken.ErrorGeometry;
+ growlInfo.IconBrushKey ??= ResourceToken.DangerBrush;
+ }
+ break;
+ case InfoType.Fatal:
+ if (!growlInfo.IsCustom)
+ {
+ growlInfo.IconKey = ResourceToken.FatalGeometry;
+ growlInfo.IconBrushKey = ResourceToken.PrimaryTextBrush;
+ growlInfo.StaysOpen = true;
+ growlInfo.ShowCloseButton = false;
+ if (GrowlPanel.ContextMenu != null) GrowlPanel.ContextMenu.Opacity = 0;
+ }
+ else
+ {
+ growlInfo.IconKey ??= ResourceToken.FatalGeometry;
+ growlInfo.IconBrushKey ??= ResourceToken.PrimaryTextBrush;
+ }
+ break;
+ case InfoType.Ask:
+ growlInfo.StaysOpen = true;
+ growlInfo.ShowCloseButton = false;
+ if (!growlInfo.IsCustom)
+ {
+ growlInfo.IconKey = ResourceToken.AskGeometry;
+ growlInfo.IconBrushKey = ResourceToken.AccentBrush;
+ }
+ else
+ {
+ growlInfo.IconKey ??= ResourceToken.AskGeometry;
+ growlInfo.IconBrushKey ??= ResourceToken.AccentBrush;
+ }
+ break;
+ default:
+ throw new ArgumentOutOfRangeException(nameof(infoType), infoType, null);
+ }
+ }
+
///
/// 成功
///
@@ -420,16 +567,29 @@ namespace HandyControl.Controls
///
public static void Success(GrowlInfo growlInfo)
{
- if (growlInfo == null) throw new ArgumentNullException(nameof(growlInfo));
- if (!growlInfo.IsCustom)
- {
- growlInfo.IconKey = ResourceToken.SuccessGeometry;
- growlInfo.IconBrushKey = ResourceToken.SuccessBrush;
- growlInfo.Type = InfoType.Success;
- }
+ InitGrowlInfo(ref growlInfo, InfoType.Success);
Show(growlInfo);
}
+ ///
+ /// 成功
+ ///
+ ///
+ public static void SuccessGlobal(string message) => SuccessGlobal(new GrowlInfo
+ {
+ Message = message
+ });
+
+ ///
+ /// 成功
+ ///
+ ///
+ public static void SuccessGlobal(GrowlInfo growlInfo)
+ {
+ InitGrowlInfo(ref growlInfo, InfoType.Success);
+ ShowGlobal(growlInfo);
+ }
+
///
/// 消息
///
@@ -447,16 +607,29 @@ namespace HandyControl.Controls
///
public static void Info(GrowlInfo growlInfo)
{
- if (growlInfo == null) throw new ArgumentNullException(nameof(growlInfo));
- if (!growlInfo.IsCustom)
- {
- growlInfo.IconKey = ResourceToken.InfoGeometry;
- growlInfo.IconBrushKey = ResourceToken.InfoBrush;
- growlInfo.Type = InfoType.Info;
- }
+ InitGrowlInfo(ref growlInfo, InfoType.Info);
Show(growlInfo);
}
+ ///
+ /// 消息
+ ///
+ ///
+ public static void InfoGlobal(string message) => InfoGlobal(new GrowlInfo
+ {
+ Message = message
+ });
+
+ ///
+ /// 消息
+ ///
+ ///
+ public static void InfoGlobal(GrowlInfo growlInfo)
+ {
+ InitGrowlInfo(ref growlInfo, InfoType.Info);
+ ShowGlobal(growlInfo);
+ }
+
///
/// 警告
///
@@ -474,16 +647,29 @@ namespace HandyControl.Controls
///
public static void Warning(GrowlInfo growlInfo)
{
- if (growlInfo == null) throw new ArgumentNullException(nameof(growlInfo));
- if (!growlInfo.IsCustom)
- {
- growlInfo.IconKey = ResourceToken.WarningGeometry;
- growlInfo.IconBrushKey = ResourceToken.WarningBrush;
- growlInfo.Type = InfoType.Warning;
- }
+ InitGrowlInfo(ref growlInfo, InfoType.Warning);
Show(growlInfo);
}
+ ///
+ /// 警告
+ ///
+ ///
+ public static void WarningGlobal(string message) => WarningGlobal(new GrowlInfo
+ {
+ Message = message
+ });
+
+ ///
+ /// 警告
+ ///
+ ///
+ public static void WarningGlobal(GrowlInfo growlInfo)
+ {
+ InitGrowlInfo(ref growlInfo, InfoType.Warning);
+ ShowGlobal(growlInfo);
+ }
+
///
/// 错误
///
@@ -501,17 +687,29 @@ namespace HandyControl.Controls
///
public static void Error(GrowlInfo growlInfo)
{
- if (growlInfo == null) throw new ArgumentNullException(nameof(growlInfo));
- if (!growlInfo.IsCustom)
- {
- growlInfo.IconKey = ResourceToken.ErrorGeometry;
- growlInfo.IconBrushKey = ResourceToken.DangerBrush;
- growlInfo.StaysOpen = true;
- growlInfo.Type = InfoType.Error;
- }
+ InitGrowlInfo(ref growlInfo, InfoType.Error);
Show(growlInfo);
}
+ ///
+ /// 错误
+ ///
+ ///
+ public static void ErrorGlobal(string message) => ErrorGlobal(new GrowlInfo
+ {
+ Message = message
+ });
+
+ ///
+ /// 错误
+ ///
+ ///
+ public static void ErrorGlobal(GrowlInfo growlInfo)
+ {
+ InitGrowlInfo(ref growlInfo, InfoType.Error);
+ ShowGlobal(growlInfo);
+ }
+
///
/// 严重
///
@@ -529,19 +727,29 @@ namespace HandyControl.Controls
///
public static void Fatal(GrowlInfo growlInfo)
{
- if (growlInfo == null) throw new ArgumentNullException(nameof(growlInfo));
- if (!growlInfo.IsCustom)
- {
- growlInfo.IconKey = ResourceToken.FatalGeometry;
- growlInfo.IconBrushKey = ResourceToken.PrimaryTextBrush;
- growlInfo.StaysOpen = true;
- growlInfo.ShowCloseButton = false;
- growlInfo.Type = InfoType.Fatal;
- if (GrowlPanel.ContextMenu != null) GrowlPanel.ContextMenu.Opacity = 0;
- }
+ InitGrowlInfo(ref growlInfo, InfoType.Fatal);
Show(growlInfo);
}
+ ///
+ /// 严重
+ ///
+ ///
+ public static void FatalGlobal(string message) => FatalGlobal(new GrowlInfo
+ {
+ Message = message
+ });
+
+ ///
+ /// 严重
+ ///
+ ///
+ public static void FatalGlobal(GrowlInfo growlInfo)
+ {
+ InitGrowlInfo(ref growlInfo, InfoType.Fatal);
+ ShowGlobal(growlInfo);
+ }
+
///
/// 询问
///
@@ -561,34 +769,58 @@ namespace HandyControl.Controls
///
public static void Ask(GrowlInfo growlInfo)
{
- if (growlInfo == null) throw new ArgumentNullException(nameof(growlInfo));
- if (!growlInfo.IsCustom)
- {
- growlInfo.IconKey = ResourceToken.AskGeometry;
- growlInfo.IconBrushKey = ResourceToken.AccentBrush;
- growlInfo.StaysOpen = true;
- growlInfo.ShowCloseButton = false;
- growlInfo.Type = InfoType.Ask;
- }
+ InitGrowlInfo(ref growlInfo, InfoType.Ask);
Show(growlInfo);
}
+ ///
+ /// 询问
+ ///
+ ///
+ ///
+ public static void AskGlobal(string message, Func actionBeforeClose) => AskGlobal(new GrowlInfo
+ {
+ Message = message,
+ ActionBeforeClose = actionBeforeClose
+ });
+
+ ///
+ /// 询问
+ ///
+ ///
+ public static void AskGlobal(GrowlInfo growlInfo)
+ {
+ InitGrowlInfo(ref growlInfo, InfoType.Ask);
+ ShowGlobal(growlInfo);
+ }
+
private void ButtonClose_OnClick(object sender, RoutedEventArgs e) => Close();
///
/// 关闭
///
- private void Close()
+ private void Close(bool invokeActionBeforeClose = false, bool invokeParam = true)
{
+ if (invokeActionBeforeClose)
+ {
+ if (ActionBeforeClose?.Invoke(invokeParam) == false) return;
+ }
+
_timerClose?.Stop();
var transform = new TranslateTransform();
_gridMain.RenderTransform = transform;
- var animation = AnimationHelper.CreateAnimation(MaxWidth);
+ var animation = AnimationHelper.CreateAnimation(ActualWidth);
animation.Completed += (s, e) =>
{
if (Parent is Panel panel)
{
panel.Children.Remove(this);
+
+ if (GrowlWindow?.GrowlPanel != null && GrowlWindow.GrowlPanel.Children.Count == 0)
+ {
+ GrowlWindow.Close();
+ GrowlWindow = null;
+ }
}
};
transform.BeginAnimation(TranslateTransform.XProperty, animation);
@@ -619,6 +851,7 @@ namespace HandyControl.Controls
///
private static void Clear(Panel panel)
{
+ if (panel == null) return;
panel.Children.Clear();
if (panel.ContextMenu != null)
{
@@ -627,20 +860,19 @@ namespace HandyControl.Controls
}
}
- private void ButtonCancel_OnClick(object sender, RoutedEventArgs e)
+ ///
+ /// 清除
+ ///
+ public static void ClearGlobal()
{
- if (ActionBeforeClose?.Invoke(false) == true)
- {
- Close();
- }
+ if (GrowlWindow == null) return;
+ Clear(GrowlWindow.GrowlPanel);
+ GrowlWindow.Close();
+ GrowlWindow = null;
}
- private void ButtonOk_OnClick(object sender, RoutedEventArgs e)
- {
- if (ActionBeforeClose?.Invoke(true) == true)
- {
- Close();
- }
- }
+ private void ButtonCancel_OnClick(object sender, RoutedEventArgs e) => Close(true, false);
+
+ private void ButtonOk_OnClick(object sender, RoutedEventArgs e) => Close(true);
}
}
\ 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
new file mode 100644
index 00000000..59e1214d
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs
@@ -0,0 +1,37 @@
+using System.Windows;
+using System.Windows.Controls;
+
+namespace HandyControl.Controls
+{
+ public sealed class GrowlWindow : Window
+ {
+ internal Panel GrowlPanel { get; set; }
+
+ internal GrowlWindow()
+ {
+ WindowStyle = WindowStyle.None;
+ AllowsTransparency = true;
+
+ GrowlPanel = new StackPanel
+ {
+ VerticalAlignment = VerticalAlignment.Top,
+ Margin = new Thickness(0, 10, 10, 10)
+ };
+
+ Content = new ScrollViewer
+ {
+ VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
+ IsInertiaEnabled = true,
+ Content = GrowlPanel
+ };
+ }
+
+ internal void Init()
+ {
+ var desktopWorkingArea = SystemParameters.WorkArea;
+ Height = desktopWorkingArea.Height;
+ Left = desktopWorkingArea.Right - Width;
+ Top = 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Image/GifImage.cs b/src/Shared/HandyControl_Shared/Controls/Image/GifImage.cs
index e352119a..114e273b 100644
--- a/src/Shared/HandyControl_Shared/Controls/Image/GifImage.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Image/GifImage.cs
@@ -39,8 +39,18 @@ namespace HandyControl.Controls
private static void OnUriChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctl = (GifImage) d;
- var v = (Uri)e.NewValue;
- ctl.Source = new BitmapImage(v);
+ ctl.StopAnimate();
+
+ if (e.NewValue != null)
+ {
+ var v = (Uri)e.NewValue;
+ ctl.GetGifStreamFromPack(v);
+ ctl.StartAnimate();
+ }
+ else
+ {
+ ctl.Source = null;
+ }
}
public Uri Uri
@@ -83,6 +93,8 @@ namespace HandyControl.Controls
StartAnimate();
}
};
+
+ Unloaded += (s, e) => Dispose();
}
public GifImage(string filename)
diff --git a/src/Shared/HandyControl_Shared/Controls/Image/ImageBlock.cs b/src/Shared/HandyControl_Shared/Controls/Image/ImageBlock.cs
index ab21849f..1093a4fe 100644
--- a/src/Shared/HandyControl_Shared/Controls/Image/ImageBlock.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Image/ImageBlock.cs
@@ -23,13 +23,46 @@ namespace HandyControl.Controls
private int _blockHeight;
+ private bool _isDisposed;
+
public ImageBlock()
{
- _dispatcherTimer = new DispatcherTimer
+ _dispatcherTimer = new DispatcherTimer(DispatcherPriority.Render)
{
Interval = Interval
};
- _dispatcherTimer.Tick += DispatcherTimer_Tick;
+
+ IsVisibleChanged += ImageBlock_IsVisibleChanged;
+ }
+
+ ~ImageBlock() => Dispose();
+
+ public void Dispose()
+ {
+ if (_isDisposed) return;
+
+ IsVisibleChanged -= ImageBlock_IsVisibleChanged;
+ _dispatcherTimer.Stop();
+ _isDisposed = true;
+
+ GC.SuppressFinalize(this);
+ }
+
+ private void ImageBlock_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
+ {
+ if(IsVisible)
+ {
+ _dispatcherTimer.Tick += DispatcherTimer_Tick;
+ if (IsPlaying)
+ {
+ _dispatcherTimer.Start();
+ }
+ }
+ else
+ {
+ _dispatcherTimer.Stop();
+ _dispatcherTimer.Tick -= DispatcherTimer_Tick;
+ }
}
private void UpdateDatas()
@@ -187,4 +220,4 @@ namespace HandyControl.Controls
return rect;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Shared/HandyControl_Shared/Controls/Input/DateTimePicker.cs b/src/Shared/HandyControl_Shared/Controls/Input/DateTimePicker.cs
index 55427b99..06bb6454 100644
--- a/src/Shared/HandyControl_Shared/Controls/Input/DateTimePicker.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Input/DateTimePicker.cs
@@ -40,7 +40,7 @@ namespace HandyControl.Controls
private ButtonBase _dropDownButton;
- private Popup _popUp;
+ private Popup _popup;
private bool _disablePopupReopen;
@@ -135,9 +135,9 @@ namespace HandyControl.Controls
var dp = d as DateTimePicker;
var newValue = (bool)e.NewValue;
- if (dp?._popUp != null && dp._popUp.IsOpen != newValue)
+ if (dp?._popup != null && dp._popup.IsOpen != newValue)
{
- dp._popUp.IsOpen = newValue;
+ dp._popup.IsOpen = newValue;
if (newValue)
{
dp._originalSelectedDateTime = dp.SelectedDateTime;
@@ -147,7 +147,6 @@ namespace HandyControl.Controls
dp._calendarWithClock.Focus();
});
}
-
}
}
@@ -276,12 +275,12 @@ namespace HandyControl.Controls
public override void OnApplyTemplate()
{
if (DesignerProperties.GetIsInDesignMode(this)) return;
- if (_popUp != null)
+ if (_popup != null)
{
- _popUp.PreviewMouseLeftButtonDown -= PopUp_PreviewMouseLeftButtonDown;
- _popUp.Opened -= PopUp_Opened;
- _popUp.Closed -= PopUp_Closed;
- _popUp.Child = null;
+ _popup.PreviewMouseLeftButtonDown -= PopupPreviewMouseLeftButtonDown;
+ _popup.Opened -= PopupOpened;
+ _popup.Closed -= PopupClosed;
+ _popup.Child = null;
}
if (_dropDownButton != null)
@@ -299,20 +298,20 @@ namespace HandyControl.Controls
base.OnApplyTemplate();
- _popUp = GetTemplateChild(ElementPopup) as Popup;
+ _popup = GetTemplateChild(ElementPopup) as Popup;
_dropDownButton = GetTemplateChild(ElementButton) as Button;
_textBox = GetTemplateChild(ElementTextBox) as WatermarkTextBox;
CheckNull();
- _popUp.PreviewMouseLeftButtonDown += PopUp_PreviewMouseLeftButtonDown;
- _popUp.Opened += PopUp_Opened;
- _popUp.Closed += PopUp_Closed;
- _popUp.Child = _calendarWithClock;
+ _popup.PreviewMouseLeftButtonDown += PopupPreviewMouseLeftButtonDown;
+ _popup.Opened += PopupOpened;
+ _popup.Closed += PopupClosed;
+ _popup.Child = _calendarWithClock;
if (IsDropDownOpen)
{
- _popUp.IsOpen = true;
+ _popup.IsOpen = true;
}
_dropDownButton.Click += DropDownButton_Click;
@@ -398,7 +397,7 @@ namespace HandyControl.Controls
private void CheckNull()
{
- if (_dropDownButton == null || _popUp == null || _textBox == null)
+ if (_dropDownButton == null || _popup == null || _textBox == null)
throw new Exception();
}
@@ -412,7 +411,7 @@ namespace HandyControl.Controls
_calendarWithClock.Confirmed += CalendarWithClock_Confirmed;
}
- private void CalendarWithClock_Confirmed() => TogglePopUp();
+ private void CalendarWithClock_Confirmed() => TogglePopup();
private void CalendarWithClock_SelectedDateTimeChanged(object sender, FunctionEventArgs e) => SelectedDateTime = e.Info;
@@ -469,7 +468,7 @@ namespace HandyControl.Controls
{
if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt)
{
- TogglePopUp();
+ TogglePopup();
return true;
}
@@ -505,7 +504,7 @@ namespace HandyControl.Controls
return _isHandlerSuspended != null && _isHandlerSuspended.ContainsKey(property);
}
- private void PopUp_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ private void PopupPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (sender is Popup popup && !popup.StaysOpen)
{
@@ -516,7 +515,7 @@ namespace HandyControl.Controls
}
}
- private void PopUp_Opened(object sender, EventArgs e)
+ private void PopupOpened(object sender, EventArgs e)
{
if (!IsDropDownOpen)
{
@@ -528,7 +527,7 @@ namespace HandyControl.Controls
OnPickerOpened(new RoutedEventArgs());
}
- private void PopUp_Closed(object sender, EventArgs e)
+ private void PopupClosed(object sender, EventArgs e)
{
if (IsDropDownOpen)
{
@@ -543,9 +542,9 @@ namespace HandyControl.Controls
OnPickerClosed(new RoutedEventArgs());
}
- private void DropDownButton_Click(object sender, RoutedEventArgs e) => TogglePopUp();
+ private void DropDownButton_Click(object sender, RoutedEventArgs e) => TogglePopup();
- private void TogglePopUp()
+ private void TogglePopup()
{
if (IsDropDownOpen)
{
@@ -623,6 +622,11 @@ namespace HandyControl.Controls
if (SelectedDateTime != null)
{
+ if (SelectedDateTime != DisplayDateTime)
+ {
+ SetCurrentValue(DisplayDateTimeProperty, SelectedDateTime);
+ }
+
var selectedTime = DateTimeToString(SelectedDateTime.Value);
if (string.Compare(selectedTime, s, StringComparison.Ordinal) == 0)
diff --git a/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs b/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs
index 5f8f3f48..d2e2b08b 100644
--- a/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs
@@ -13,38 +13,46 @@ namespace HandyControl.Controls
/// 数值选择控件
///
[TemplatePart(Name = ElementTextBox, Type = typeof(TextBox))]
+ [TemplatePart(Name = ElementErrorTip, Type = typeof(UIElement))]
public class NumericUpDown : Control, IDataInput
{
#region Constants
private const string ElementTextBox = "PART_TextBox";
+ private const string ElementErrorTip = "PART_ErrorTip";
+
#endregion Constants
#region Data
private TextBox _textBox;
+ private UIElement _errorTip;
+
+ private bool _updateText;
+
#endregion Data
public NumericUpDown()
{
CommandBindings.Add(new CommandBinding(ControlCommands.Prev, (s, e) =>
{
+ if (IsReadOnly) return;
+
Value += Increment;
- _textBox.Text = CurrentText;
- _textBox.Select(_textBox.Text.Length, 0);
}));
CommandBindings.Add(new CommandBinding(ControlCommands.Next, (s, e) =>
{
+ if (IsReadOnly) return;
+
Value -= Increment;
- _textBox.Text = CurrentText;
- _textBox.Select(_textBox.Text.Length, 0);
}));
CommandBindings.Add(new CommandBinding(ControlCommands.Clear, (s, e) =>
{
- SetCurrentValue(ValueProperty, 0d);
- _textBox.Text = string.Empty;
+ if (IsReadOnly) return;
+
+ SetCurrentValue(ValueProperty, ValueBoxes.Double0Box);
}));
Loaded += (s, e) => OnApplyTemplate();
@@ -65,7 +73,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;
}
@@ -73,42 +82,50 @@ namespace HandyControl.Controls
base.OnApplyTemplate();
_textBox = GetTemplateChild(ElementTextBox) as TextBox;
+ _errorTip = GetTemplateChild(ElementErrorTip) as UIElement;
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))
+ {
+ _updateText = false;
+ Value = value;
+ _updateText = true;
+ }
+ }
+
+ private void PreviewTextInputHandler(object sender, TextCompositionEventArgs e) => UpdateData();
+
private void TextBox_LostFocus(object sender, RoutedEventArgs e)
{
- if (IsError) return;
+ if (IsError && _errorTip != null) return;
_textBox.Text = CurrentText;
}
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
+ if (IsReadOnly) return;
+
if (e.Key == Key.Up)
{
Value += Increment;
- _textBox.Text = CurrentText;
}
else if (e.Key == Key.Down)
{
Value -= Increment;
- _textBox.Text = CurrentText;
- }
- }
-
- private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
- {
- if (!VerifyData()) return;
- if (double.TryParse(_textBox.Text, out var value))
- {
- Value = value;
}
}
@@ -116,11 +133,9 @@ namespace HandyControl.Controls
{
base.OnMouseWheel(e);
- if (_textBox.IsFocused)
+ if (_textBox.IsFocused && !IsReadOnly)
{
Value += e.Delta > 0 ? Increment : -Increment;
- _textBox.Text = CurrentText;
- _textBox.Select(_textBox.Text.Length, 0);
e.Handled = true;
}
}
@@ -159,9 +174,10 @@ namespace HandyControl.Controls
{
var ctl = (NumericUpDown) d;
var v = (double) e.NewValue;
- if (ctl._textBox != null)
+ if (ctl._updateText && ctl._textBox != null)
{
- ctl._textBox.Text = v.ToString();
+ ctl._textBox.Text = ctl.CurrentText;
+ ctl._textBox.Select(ctl._textBox.Text.Length, 0);
}
ctl.OnValueChanged(new FunctionEventArgs(ValueChangedEvent, ctl)
@@ -186,13 +202,7 @@ namespace HandyControl.Controls
ctl.Value = maximum;
}
- var result = num > maximum ? maximum : num;
- if (!ctl.DecimalPlaces.HasValue)
- {
- result = Math.Floor(result);
- }
-
- return result;
+ return num > maximum ? maximum : num;
}
///
@@ -353,7 +363,22 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool) GetValue(ShowClearButtonProperty);
- set => SetValue(ShowClearButtonProperty, value);
+ set => SetValue(ShowClearButtonProperty, value);
+ }
+
+ ///
+ /// 标识 IsReadOnly 依赖属性。
+ ///
+ public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register(
+ "IsReadOnly", typeof(bool), typeof(NumericUpDown), new PropertyMetadata(ValueBoxes.FalseBox));
+
+ ///
+ /// 获取或设置一个值,该值指示NumericUpDown是否只读。
+ ///
+ public bool IsReadOnly
+ {
+ get => (bool) GetValue(IsReadOnlyProperty);
+ set => SetValue(IsReadOnlyProperty, value);
}
public Func> VerifyFunc { get; set; }
diff --git a/src/Shared/HandyControl_Shared/Controls/Input/PasswordBox.cs b/src/Shared/HandyControl_Shared/Controls/Input/PasswordBox.cs
index 56c68892..5fdd95be 100644
--- a/src/Shared/HandyControl_Shared/Controls/Input/PasswordBox.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Input/PasswordBox.cs
@@ -60,8 +60,6 @@ namespace HandyControl.Controls
private SecureString _password;
- private char _passwordChar;
-
private System.Windows.Controls.TextBox _textBox;
public PasswordBox()
@@ -223,12 +221,6 @@ namespace HandyControl.Controls
}
}
}
-
- if (_passwordChar != default(char))
- {
- ActualPasswordBox.PasswordChar = _passwordChar;
- _passwordChar = default(char);
- }
}
if (_textBox != null)
diff --git a/src/Shared/HandyControl_Shared/Controls/Input/PinBox.cs b/src/Shared/HandyControl_Shared/Controls/Input/PinBox.cs
new file mode 100644
index 00000000..89fa3e43
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Input/PinBox.cs
@@ -0,0 +1,339 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Security;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using HandyControl.Data;
+using HandyControl.Tools;
+using HandyControl.Tools.Extension;
+
+namespace HandyControl.Controls
+{
+ [TemplatePart(Name = ElementPanel, Type = typeof(Panel))]
+ public class PinBox : Control
+ {
+ private const string ElementPanel = "PART_Panel";
+
+ private static readonly object MinLength = 4;
+
+ private Panel _panel;
+
+ private int _inputIndex;
+
+ private bool _changed;
+
+ private bool _isInternalAction;
+
+ private List _passwordList;
+
+ private RoutedEventHandler _passwordBoxsGotFocusEventHandler;
+
+ private RoutedEventHandler _passwordBoxsPasswordChangedEventHandler;
+
+ public PinBox()
+ {
+ Loaded += PinBox_Loaded;
+ Unloaded += PinBox_Unloaded;
+ }
+
+ private void PinBox_Unloaded(object sender, RoutedEventArgs e)
+ {
+ RemoveHandler(System.Windows.Controls.PasswordBox.PasswordChangedEvent, _passwordBoxsPasswordChangedEventHandler);
+ RemoveHandler(GotFocusEvent, _passwordBoxsGotFocusEventHandler);
+
+ Loaded -= PinBox_Loaded;
+ Unloaded -= PinBox_Unloaded;
+ }
+
+ private void PinBox_Loaded(object sender, RoutedEventArgs e)
+ {
+ _passwordBoxsPasswordChangedEventHandler = PasswordBoxsPasswordChanged;
+ AddHandler(System.Windows.Controls.PasswordBox.PasswordChangedEvent, _passwordBoxsPasswordChangedEventHandler);
+
+ _passwordBoxsGotFocusEventHandler = PasswordBoxsGotFocus;
+ AddHandler(GotFocusEvent, _passwordBoxsGotFocusEventHandler);
+ }
+
+ private void PasswordBoxsPasswordChanged(object sender, RoutedEventArgs e)
+ {
+ if (_isInternalAction) return;
+
+ if (e.OriginalSource is System.Windows.Controls.PasswordBox passwordBox)
+ {
+ if (passwordBox.Password.Length > 0)
+ {
+ if (++_inputIndex >= Length)
+ {
+ _inputIndex = Length - 1;
+
+ if (_panel.Children.OfType()
+ .All(item => item.Password.Any()))
+ {
+ FocusManager.SetFocusedElement(this, null);
+ Keyboard.ClearFocus();
+ RaiseEvent(new RoutedEventArgs(CompletedEvent, this));
+ }
+ return;
+ }
+ }
+ else
+ {
+ if (--_inputIndex < 0)
+ {
+ _inputIndex = 0;
+ return;
+ }
+ }
+
+ _changed = true;
+ FocusManager.SetFocusedElement(this, _panel.Children[_inputIndex]);
+ }
+ }
+
+ private void PasswordBoxsGotFocus(object sender, RoutedEventArgs e)
+ {
+ if (e.OriginalSource is System.Windows.Controls.PasswordBox passwordBox)
+ {
+ _inputIndex = _panel.Children.IndexOf(passwordBox);
+ passwordBox.SelectAll();
+ }
+ }
+
+ protected override void OnPreviewKeyDown(KeyEventArgs e)
+ {
+ base.OnPreviewKeyUp(e);
+
+ if (e.Key == Key.Left)
+ {
+ if (--_inputIndex < 0)
+ {
+ _inputIndex = 0;
+ return;
+ }
+
+ var passwordBox = _panel.Children[_inputIndex] as System.Windows.Controls.PasswordBox;
+ passwordBox?.SelectAll();
+
+ FocusManager.SetFocusedElement(this, passwordBox);
+ }
+ else if (e.Key == Key.Right)
+ {
+ if (++_inputIndex >= Length)
+ {
+ _inputIndex = Length - 1;
+ return;
+ }
+
+ var passwordBox = _panel.Children[_inputIndex] as System.Windows.Controls.PasswordBox;
+ passwordBox?.SelectAll();
+
+ FocusManager.SetFocusedElement(this, passwordBox);
+ }
+ }
+
+ protected override void OnPreviewKeyUp(KeyEventArgs e)
+ {
+ base.OnPreviewKeyUp(e);
+
+ if (_changed)
+ {
+ _changed = false;
+ return;
+ }
+
+ if (e.Key == Key.Delete || e.Key == Key.Back)
+ {
+ if (_panel.Children[_inputIndex] is System.Windows.Controls.PasswordBox passwordBox)
+ {
+ _isInternalAction = true;
+ passwordBox.Clear();
+ _isInternalAction = false;
+ }
+
+ if (--_inputIndex < 0)
+ {
+ _inputIndex = 0;
+ return;
+ }
+
+ FocusManager.SetFocusedElement(this, _panel.Children[_inputIndex]);
+ }
+ }
+
+ public string Password
+ {
+ get
+ {
+ return string.Join("", _panel.Children.OfType().Select(item => item.Password));
+ }
+ set
+ {
+ if (_panel == null)
+ {
+ _passwordList = new List();
+
+ if (value == null)
+ {
+ value = string.Empty;
+ }
+
+ foreach (var item in value)
+ {
+ var secureString = new SecureString();
+ secureString.AppendChar(item);
+ _passwordList.Add(secureString);
+ }
+
+ return;
+ }
+
+ var length = Length;
+ if (string.IsNullOrEmpty(value) || value.Length != length || value.Length != _panel.Children.Count)
+ {
+ _panel.Children.OfType().Do(item => item.Clear());
+ }
+ else
+ {
+ _panel.Children.OfType().DoWithIndex((item, index) => item.Password = value[index].ToString());
+ }
+ }
+ }
+
+ ///
+ /// 掩码字符
+ ///
+ public static readonly DependencyProperty PasswordCharProperty =
+ System.Windows.Controls.PasswordBox.PasswordCharProperty.AddOwner(typeof(PinBox),
+ new FrameworkPropertyMetadata('●'));
+
+ public char PasswordChar
+ {
+ get => (char)GetValue(PasswordCharProperty);
+ set => SetValue(PasswordCharProperty, value);
+ }
+
+ public static readonly DependencyProperty LengthProperty = DependencyProperty.Register(
+ "Length", typeof(int), typeof(PinBox), new PropertyMetadata(MinLength, OnLengthChanged, CoerceLength), ValidateHelper.IsInRangeOfPosInt);
+
+ private static void OnLengthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var ctl = (PinBox) d;
+ ctl.UpdateItems();
+ }
+
+ private static object CoerceLength(DependencyObject d, object basevalue) => (int)basevalue < 4 ? MinLength : basevalue;
+
+ public int Length
+ {
+ get => (int) GetValue(LengthProperty);
+ set => SetValue(LengthProperty, value);
+ }
+
+ public static readonly DependencyProperty ItemMarginProperty = DependencyProperty.Register(
+ "ItemMargin", typeof(Thickness), typeof(PinBox), new PropertyMetadata(default(Thickness)));
+
+ public Thickness ItemMargin
+ {
+ get => (Thickness) GetValue(ItemMarginProperty);
+ set => SetValue(ItemMarginProperty, value);
+ }
+
+ public static readonly DependencyProperty ItemWidthProperty = DependencyProperty.Register(
+ "ItemWidth", typeof(double), typeof(PinBox), new PropertyMetadata(ValueBoxes.Double0Box));
+
+ public double ItemWidth
+ {
+ get => (double) GetValue(ItemWidthProperty);
+ set => SetValue(ItemWidthProperty, value);
+ }
+
+ public static readonly DependencyProperty ItemHeightProperty = DependencyProperty.Register(
+ "ItemHeight", typeof(double), typeof(PinBox), new PropertyMetadata(ValueBoxes.Double0Box));
+
+ public double ItemHeight
+ {
+ get => (double) GetValue(ItemHeightProperty);
+ set => SetValue(ItemHeightProperty, value);
+ }
+
+ public static readonly RoutedEvent CompletedEvent =
+ EventManager.RegisterRoutedEvent("Completed", RoutingStrategy.Bubble,
+ typeof(RoutedEventHandler), typeof(PinBox));
+
+ public event RoutedEventHandler Completed
+ {
+ add => AddHandler(CompletedEvent, value);
+ remove => RemoveHandler(CompletedEvent, value);
+ }
+
+ private void UpdateItems()
+ {
+ if (_panel == null) return;
+
+ _panel.Children.Clear();
+ var length = Length;
+
+ for (var i = 0; i < length; i++)
+ {
+ _panel.Children.Add(CreatePasswordBox());
+ }
+ }
+
+ private System.Windows.Controls.PasswordBox CreatePasswordBox()
+ {
+ return new System.Windows.Controls.PasswordBox
+ {
+ MaxLength = 1,
+ HorizontalContentAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ Margin = ItemMargin,
+ Width = ItemWidth,
+ Height = ItemHeight,
+ Padding = default,
+ PasswordChar = PasswordChar
+ };
+ }
+
+ public override void OnApplyTemplate()
+ {
+ base.OnApplyTemplate();
+
+ _panel = GetTemplateChild(ElementPanel) as Panel;
+ if (_panel != null)
+ {
+ UpdateItems();
+
+ var length = Length;
+ if (_passwordList != null && _passwordList.Count == length && _panel.Children.Count == length)
+ {
+ for (var i = 0; i < length; i++)
+ {
+ var password = _passwordList[i];
+ if (password.Length > 0)
+ {
+ var valuePtr = IntPtr.Zero;
+ try
+ {
+ valuePtr = Marshal.SecureStringToGlobalAllocUnicode(password);
+ if (_panel.Children[i] is System.Windows.Controls.PasswordBox passwordBox)
+ {
+ passwordBox.Password = Marshal.PtrToStringUni(valuePtr) ?? throw new InvalidOperationException();
+ }
+ }
+ finally
+ {
+ Marshal.ZeroFreeGlobalAllocUnicode(valuePtr);
+ password.Clear();
+ }
+ }
+ }
+
+ _passwordList.Clear();
+ }
+ }
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Controls/Input/SearchBar.cs b/src/Shared/HandyControl_Shared/Controls/Input/SearchBar.cs
index 3b13e84e..75341640 100644
--- a/src/Shared/HandyControl_Shared/Controls/Input/SearchBar.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Input/SearchBar.cs
@@ -52,14 +52,16 @@ namespace HandyControl.Controls
Info = Text
});
- if (Command == null) return;
- if (Command is RoutedCommand command)
+ switch (Command)
{
- command.Execute(CommandParameter, CommandTarget);
- }
- else
- {
- Command.Execute(CommandParameter);
+ case null:
+ return;
+ case RoutedCommand command:
+ command.Execute(CommandParameter, CommandTarget);
+ break;
+ default:
+ Command.Execute(CommandParameter);
+ break;
}
}
diff --git a/src/Shared/HandyControl_Shared/Controls/Input/TimePicker.cs b/src/Shared/HandyControl_Shared/Controls/Input/TimePicker.cs
index d3679040..4a6b84e8 100644
--- a/src/Shared/HandyControl_Shared/Controls/Input/TimePicker.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Input/TimePicker.cs
@@ -38,7 +38,7 @@ namespace HandyControl.Controls
private ButtonBase _dropDownButton;
- private Popup _popUp;
+ private Popup _popup;
private bool _disablePopupReopen;
@@ -147,9 +147,9 @@ namespace HandyControl.Controls
var dp = d as TimePicker;
var newValue = (bool)e.NewValue;
- if (dp?._popUp != null && dp._popUp.IsOpen != newValue)
+ if (dp?._popup != null && dp._popup.IsOpen != newValue)
{
- dp._popUp.IsOpen = newValue;
+ dp._popup.IsOpen = newValue;
if (newValue)
{
dp._originalSelectedTime = dp.SelectedTime;
@@ -357,12 +357,12 @@ namespace HandyControl.Controls
public override void OnApplyTemplate()
{
if (DesignerProperties.GetIsInDesignMode(this)) return;
- if (_popUp != null)
+ if (_popup != null)
{
- _popUp.PreviewMouseLeftButtonDown -= PopUp_PreviewMouseLeftButtonDown;
- _popUp.Opened -= PopUp_Opened;
- _popUp.Closed -= PopUp_Closed;
- _popUp.Child = null;
+ _popup.PreviewMouseLeftButtonDown -= PopupPreviewMouseLeftButtonDown;
+ _popup.Opened -= PopupOpened;
+ _popup.Closed -= PopupClosed;
+ _popup.Child = null;
}
if (_dropDownButton != null)
@@ -380,20 +380,20 @@ namespace HandyControl.Controls
base.OnApplyTemplate();
- _popUp = GetTemplateChild(ElementPopup) as Popup;
+ _popup = GetTemplateChild(ElementPopup) as Popup;
_dropDownButton = GetTemplateChild(ElementButton) as Button;
_textBox = GetTemplateChild(ElementTextBox) as WatermarkTextBox;
CheckNull();
- _popUp.PreviewMouseLeftButtonDown += PopUp_PreviewMouseLeftButtonDown;
- _popUp.Opened += PopUp_Opened;
- _popUp.Closed += PopUp_Closed;
- _popUp.Child = Clock;
+ _popup.PreviewMouseLeftButtonDown += PopupPreviewMouseLeftButtonDown;
+ _popup.Opened += PopupOpened;
+ _popup.Closed += PopupClosed;
+ _popup.Child = Clock;
if (IsDropDownOpen)
{
- _popUp.IsOpen = true;
+ _popup.IsOpen = true;
}
_dropDownButton.Click += DropDownButton_Click;
@@ -450,7 +450,7 @@ namespace HandyControl.Controls
private void CheckNull()
{
- if (_dropDownButton == null || _popUp == null || _textBox == null)
+ if (_dropDownButton == null || _popup == null || _textBox == null)
throw new Exception();
}
@@ -504,7 +504,7 @@ namespace HandyControl.Controls
{
if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt)
{
- TogglePopUp();
+ TogglePopup();
return true;
}
@@ -540,7 +540,7 @@ namespace HandyControl.Controls
return _isHandlerSuspended != null && _isHandlerSuspended.ContainsKey(property);
}
- private void PopUp_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ private void PopupPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (sender is Popup popup && !popup.StaysOpen)
{
@@ -553,9 +553,9 @@ namespace HandyControl.Controls
private void Clock_SelectedTimeChanged(object sender, FunctionEventArgs e) => SelectedTime = e.Info;
- private void Clock_Confirmed() => TogglePopUp();
+ private void Clock_Confirmed() => TogglePopup();
- private void PopUp_Opened(object sender, EventArgs e)
+ private void PopupOpened(object sender, EventArgs e)
{
if (!IsDropDownOpen)
{
@@ -567,7 +567,7 @@ namespace HandyControl.Controls
OnClockOpened(new RoutedEventArgs());
}
- private void PopUp_Closed(object sender, EventArgs e)
+ private void PopupClosed(object sender, EventArgs e)
{
if (IsDropDownOpen)
{
@@ -582,9 +582,9 @@ namespace HandyControl.Controls
OnClockClosed(new RoutedEventArgs());
}
- private void DropDownButton_Click(object sender, RoutedEventArgs e) => TogglePopUp();
+ private void DropDownButton_Click(object sender, RoutedEventArgs e) => TogglePopup();
- private void TogglePopUp()
+ private void TogglePopup()
{
if (IsDropDownOpen)
{
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/AnimationPath.cs b/src/Shared/HandyControl_Shared/Controls/Other/AnimationPath.cs
index be6feef0..de1abef5 100644
--- a/src/Shared/HandyControl_Shared/Controls/Other/AnimationPath.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Other/AnimationPath.cs
@@ -12,8 +12,6 @@ namespace HandyControl.Controls
{
public class AnimationPath : Shape
{
- private bool _isLoaded;
-
///
/// 故事板
///
@@ -126,15 +124,7 @@ namespace HandyControl.Controls
OnPropertiesChanged));
}
- public AnimationPath()
- {
- Loaded += (s, e) =>
- {
- if (_isLoaded) return;
- UpdatePath();
- _isLoaded = true;
- };
- }
+ public AnimationPath() => Loaded += (s, e) => UpdatePath();
///
/// 动画完成事件
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/Badge.cs b/src/Shared/HandyControl_Shared/Controls/Other/Badge.cs
index b4a58d2a..b7268aa9 100644
--- a/src/Shared/HandyControl_Shared/Controls/Other/Badge.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Other/Badge.cs
@@ -78,5 +78,14 @@ namespace HandyControl.Controls
get => (Thickness)GetValue(BadgeMarginProperty);
set => SetValue(BadgeMarginProperty, value);
}
+
+ public static readonly DependencyProperty ShowBadgeProperty = DependencyProperty.Register(
+ "ShowBadge", typeof(bool), typeof(Badge), new PropertyMetadata(ValueBoxes.TrueBox));
+
+ public bool ShowBadge
+ {
+ get => (bool) GetValue(ShowBadgeProperty);
+ set => SetValue(ShowBadgeProperty, value);
+ }
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/Carousel.cs b/src/Shared/HandyControl_Shared/Controls/Other/Carousel.cs
index 9fd38c42..47ac493a 100644
--- a/src/Shared/HandyControl_Shared/Controls/Other/Carousel.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Other/Carousel.cs
@@ -8,7 +8,6 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Markup;
-using System.Windows.Media;
using System.Windows.Threading;
using HandyControl.Data;
using HandyControl.Interactivity;
@@ -23,7 +22,7 @@ namespace HandyControl.Controls
[ContentProperty("Items")]
[TemplatePart(Name = ElementPanelPage, Type = typeof(Panel))]
[TemplatePart(Name = ElementItemsControl, Type = typeof(ItemsPresenter))]
- public class Carousel : ListBox
+ public class Carousel : ListBox, IDisposable
{
#region Constants
@@ -34,6 +33,8 @@ namespace HandyControl.Controls
#region Data
+ private bool _isDisposed;
+
private Panel _panelPage;
private bool _appliedTemplate;
@@ -42,7 +43,7 @@ namespace HandyControl.Controls
private int _pageIndex = -1;
- private Button _selectedButton;
+ private RadioButton _selectedButton;
private DispatcherTimer _updateTimer;
@@ -104,6 +105,15 @@ namespace HandyControl.Controls
set => SetValue(IsCenterProperty, value);
}
+ public static readonly DependencyProperty PageButtonStyleProperty = DependencyProperty.Register(
+ "PageButtonStyle", typeof(Style), typeof(Carousel), new PropertyMetadata(default(Style)));
+
+ public Style PageButtonStyle
+ {
+ get => (Style) GetValue(PageButtonStyleProperty);
+ set => SetValue(PageButtonStyleProperty, value);
+ }
+
public Carousel()
{
CommandBindings.Add(new CommandBinding(ControlCommands.Prev, ButtonPrev_OnClick));
@@ -111,6 +121,36 @@ namespace HandyControl.Controls
CommandBindings.Add(new CommandBinding(ControlCommands.Selected, ButtonPages_OnClick));
Loaded += (s, e) => UpdatePageButtons();
+ IsVisibleChanged += Carousel_IsVisibleChanged;
+ }
+
+ ~Carousel() => Dispose();
+
+ public void Dispose()
+ {
+ if (_isDisposed) return;
+
+ IsVisibleChanged -= Carousel_IsVisibleChanged;
+ _updateTimer.Stop();
+ _isDisposed = true;
+
+ GC.SuppressFinalize(this);
+ }
+
+ private void Carousel_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
+ {
+ if (_updateTimer == null) return;
+
+ if (IsVisible)
+ {
+ _updateTimer.Tick += UpdateTimer_Tick;
+ _updateTimer.Start();
+ }
+ else
+ {
+ _updateTimer.Stop();
+ _updateTimer.Tick -= UpdateTimer_Tick;
+ }
}
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
@@ -210,23 +250,22 @@ namespace HandyControl.Controls
_panelPage.Children.Clear();
for (var i = 0; i < count; i++)
{
- _panelPage.Children.Add(CreatePateButton());
+ _panelPage.Children.Add(new RadioButton
+ {
+ Style = PageButtonStyle
+ });
}
- if (index == -1)
+ if (index == -1 && count > 0) index = 0;
+ if (index >= 0 && index < count)
{
- if (count > 0)
+ if (_panelPage.Children[index] is RadioButton button)
{
- var button = _panelPage.Children[0];
+ button.IsChecked = true;
button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent, button));
+ UpdateItemsPosition();
}
}
- else if (index >= 0 && index < count)
- {
- var button = _panelPage.Children[index];
- button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent, button));
- UpdateItemsPosition();
- }
}
///
@@ -258,40 +297,17 @@ namespace HandyControl.Controls
UpdateItemsPosition();
}
- ///
- /// 创建页按钮
- ///
- ///
- private Button CreatePateButton()
- {
- var button = new Button
- {
- Style = ResourceHelper.GetResource
@@ -206,7 +206,7 @@
-
+
@@ -220,8 +220,8 @@
-
-
+
+
@@ -279,12 +279,12 @@
-
+
-
+
@@ -296,8 +296,8 @@
-
-
+
+
@@ -351,7 +351,7 @@
-
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/DateTimePickerBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DateTimePickerBaseStyle.xaml
index 2eb9d802..f29c6e51 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/DateTimePickerBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DateTimePickerBaseStyle.xaml
@@ -1,8 +1,8 @@
+ xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
+ xmlns:system="clr-namespace:System;assembly=mscorlib">
@@ -28,7 +28,7 @@
-
+
@@ -67,7 +67,7 @@
-
+
@@ -79,7 +79,7 @@
-
+
@@ -113,12 +113,12 @@
-
+
-
+
@@ -128,7 +128,7 @@
-
+
@@ -162,13 +162,15 @@
@@ -185,7 +187,7 @@
-
+
@@ -199,8 +201,8 @@
-
-
+
+
@@ -258,12 +260,12 @@
-
+
-
+
@@ -275,8 +277,8 @@
-
-
+
+
@@ -330,7 +332,7 @@
-
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml
new file mode 100644
index 00000000..1a324b26
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml
@@ -0,0 +1,63 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/DrawerBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DrawerBaseStyle.xaml
new file mode 100644
index 00000000..fd9084f3
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DrawerBaseStyle.xaml
@@ -0,0 +1,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ExpanderBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ExpanderBaseStyle.xaml
index 211affc8..a7cfbadd 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ExpanderBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ExpanderBaseStyle.xaml
@@ -1,5 +1,6 @@
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:controls="clr-namespace:HandyControl.Controls">
@@ -14,11 +15,12 @@
-
+
+
-
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/FlowDocumentBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/FlowDocumentBaseStyle.xaml
new file mode 100644
index 00000000..58ca4a9a
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/FlowDocumentBaseStyle.xaml
@@ -0,0 +1,192 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/FrameBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/FrameBaseStyle.xaml
new file mode 100644
index 00000000..cad3ed5a
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/FrameBaseStyle.xaml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/GroupBoxBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/GroupBoxBaseStyle.xaml
index ff3ac5b2..115505dc 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/GroupBoxBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/GroupBoxBaseStyle.xaml
@@ -114,7 +114,7 @@
-
+
@@ -129,7 +129,7 @@
-
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ListBoxBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ListBoxBaseStyle.xaml
index 1f6b1131..74b5337c 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ListBoxBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ListBoxBaseStyle.xaml
@@ -4,6 +4,7 @@
+
@@ -11,7 +12,7 @@
-
+
@@ -20,7 +21,7 @@
-
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/NavigationWindowBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/NavigationWindowBaseStyle.xaml
new file mode 100644
index 00000000..7811862c
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/NavigationWindowBaseStyle.xaml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/NumericUpDownBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/NumericUpDownBaseStyle.xaml
index b01ad9fd..ae0f1b99 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/NumericUpDownBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/NumericUpDownBaseStyle.xaml
@@ -16,7 +16,8 @@
-
+
+
@@ -34,9 +35,9 @@
-
-
-
+
+
+
@@ -52,6 +53,10 @@
+
+
+
+
@@ -62,7 +67,7 @@
-
+
@@ -74,9 +79,9 @@
-
-
-
+
+
+
@@ -90,16 +95,20 @@
+
+
+
+
-
+
-
+
@@ -109,9 +118,9 @@
-
-
-
+
+
+
@@ -125,18 +134,23 @@
+
+
+
+
@@ -144,18 +158,18 @@
-
+
-
+
-
+
-
+
@@ -167,10 +181,10 @@
-
-
-
-
+
+
+
+
@@ -181,10 +195,15 @@
+
+
+
+
+
@@ -206,18 +225,18 @@
-
+
-
+
-
+
-
+
@@ -229,10 +248,10 @@
-
-
-
-
+
+
+
+
@@ -243,10 +262,15 @@
+
+
+
+
+
@@ -270,7 +294,7 @@
-
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/PasswordBoxBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/PasswordBoxBaseStyle.xaml
index 6028041e..e40e028c 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/PasswordBoxBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/PasswordBoxBaseStyle.xaml
@@ -1,8 +1,8 @@
+ xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
+ xmlns:system="clr-namespace:System;assembly=mscorlib">
@@ -54,7 +54,7 @@
-
+
@@ -83,12 +83,12 @@
-
+
-
+
@@ -115,15 +115,16 @@
@@ -169,7 +170,7 @@
-
+
@@ -228,14 +229,14 @@
-
+
-
+
@@ -291,17 +292,17 @@
-
+
-
+
-
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/PinBoxBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/PinBoxBaseStyle.xaml
new file mode 100644
index 00000000..a81214d7
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/PinBoxBaseStyle.xaml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/PoptipBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/PoptipBaseStyle.xaml
new file mode 100644
index 00000000..76c1f24e
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/PoptipBaseStyle.xaml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ProgressBarBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ProgressBarBaseStyle.xaml
index cf0d398a..4e5ac058 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ProgressBarBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ProgressBarBaseStyle.xaml
@@ -1,7 +1,8 @@
+ xmlns:shapes="clr-namespace:HandyControl.Expression.Shapes"
+ xmlns:system="clr-namespace:System;assembly=mscorlib">
@@ -33,18 +34,58 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -70,11 +111,19 @@
-
+
+
+
+
+
+
+
+
+
@@ -142,8 +191,11 @@
-
-
+
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ProgressButtonBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ProgressButtonBaseStyle.xaml
index 5f1b92ff..c5606579 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ProgressButtonBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ProgressButtonBaseStyle.xaml
@@ -1,7 +1,6 @@
+ xmlns:controls="clr-namespace:HandyControl.Controls">
@@ -32,7 +31,7 @@
-
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioButtonBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioButtonBaseStyle.xaml
index 26c893c6..9ca2f6f6 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioButtonBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioButtonBaseStyle.xaml
@@ -174,7 +174,10 @@
-
+
+
+
+
@@ -185,6 +188,13 @@
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/RunningBlockBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/RunningBlockBaseStyle.xaml
new file mode 100644
index 00000000..ba1ee285
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/RunningBlockBaseStyle.xaml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ScrollViewerBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ScrollViewerBaseStyle.xaml
index 2b4074af..8395e603 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ScrollViewerBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ScrollViewerBaseStyle.xaml
@@ -22,7 +22,45 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -30,6 +68,12 @@
+
+
+
+
+
+
@@ -42,7 +86,45 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -50,6 +132,12 @@
+
+
+
+
+
+
@@ -120,10 +208,10 @@
-
+
-
+
@@ -149,12 +237,14 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -168,10 +258,10 @@
-
+
-
+
@@ -197,12 +287,14 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/SearchBarBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/SearchBarBaseStyle.xaml
index f79bfddd..71b6795f 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/SearchBarBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/SearchBarBaseStyle.xaml
@@ -1,8 +1,8 @@
+ xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
+ xmlns:system="clr-namespace:System;assembly=mscorlib">
@@ -18,7 +18,7 @@
-
+
@@ -42,7 +42,7 @@
-
+
@@ -54,7 +54,7 @@
-
+
@@ -74,12 +74,12 @@
-
+
-
+
@@ -89,7 +89,7 @@
-
+
@@ -109,13 +109,15 @@
@@ -132,7 +134,7 @@
-
+
@@ -146,8 +148,8 @@
-
-
+
+
@@ -191,12 +193,12 @@
-
+
-
+
@@ -208,8 +210,8 @@
-
-
+
+
@@ -249,7 +251,7 @@
-
+
diff --git a/DockBoxResearch/Resources/Themes/Basic/Geometries.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/SeparatorBaseStyle.xaml
similarity index 54%
rename from DockBoxResearch/Resources/Themes/Basic/Geometries.xaml
rename to src/Shared/HandyControl_Shared/Themes/Styles/Base/SeparatorBaseStyle.xaml
index 1ca0c753..2b9f91b0 100644
--- a/DockBoxResearch/Resources/Themes/Basic/Geometries.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/SeparatorBaseStyle.xaml
@@ -1,6 +1,8 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/SliderBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/SliderBaseStyle.xaml
index aac15bce..d371ad3a 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/SliderBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/SliderBaseStyle.xaml
@@ -9,7 +9,325 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
@@ -290,30 +627,37 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -668,7 +709,7 @@
-
+
@@ -699,7 +740,7 @@
-
+
@@ -730,7 +771,7 @@
-
+
@@ -761,7 +802,7 @@
-
+
@@ -821,7 +862,7 @@
-
+
@@ -829,7 +870,7 @@
-
+
@@ -879,7 +920,7 @@
-
+
@@ -887,7 +928,7 @@
-
+
@@ -922,4 +963,6 @@
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/SplitButtonBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/SplitButtonBaseStyle.xaml
new file mode 100644
index 00000000..b173b635
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/SplitButtonBaseStyle.xaml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/StatusBarBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/StatusBarBaseStyle.xaml
new file mode 100644
index 00000000..1da267ba
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/StatusBarBaseStyle.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/TextBoxBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/TextBoxBaseStyle.xaml
index f91ce695..97beb5d6 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/TextBoxBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/TextBoxBaseStyle.xaml
@@ -1,8 +1,8 @@
+ xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
+ xmlns:system="clr-namespace:System;assembly=mscorlib">
@@ -24,7 +24,7 @@
-
+
@@ -51,7 +51,7 @@
-
+
@@ -73,15 +73,15 @@
-
+
-
+
-
+
@@ -99,18 +99,18 @@
-
+
-
-
+
+
-
+
@@ -129,13 +129,14 @@
@@ -152,11 +153,11 @@
-
+
-
+
@@ -166,8 +167,8 @@
-
-
+
+
@@ -209,14 +210,14 @@
-
+
-
-
+
+
@@ -226,8 +227,8 @@
-
-
+
+
@@ -265,7 +266,7 @@
-
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/TimePickerBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/TimePickerBaseStyle.xaml
index aebdd389..d9859afa 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/TimePickerBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/TimePickerBaseStyle.xaml
@@ -1,8 +1,8 @@
+ xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
+ xmlns:system="clr-namespace:System;assembly=mscorlib">
@@ -28,7 +28,7 @@
-
+
@@ -67,7 +67,7 @@
-
+
@@ -79,7 +79,7 @@
-
+
@@ -113,12 +113,12 @@
-
+
-
+
@@ -128,7 +128,7 @@
-
+
@@ -162,13 +162,15 @@
@@ -185,7 +187,7 @@
-
+
@@ -199,8 +201,8 @@
-
-
+
+
@@ -258,12 +260,12 @@
-
+
-
+
@@ -275,8 +277,8 @@
-
-
+
+
@@ -330,7 +332,7 @@
-
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ToggleButtonBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ToggleButtonBaseStyle.xaml
index 138ffd03..94982b85 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ToggleButtonBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ToggleButtonBaseStyle.xaml
@@ -11,7 +11,6 @@
+
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/BlendEffectBox.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/BlendEffectBox.xaml
new file mode 100644
index 00000000..e10faffb
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/BlendEffectBox.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
\ 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/FlowDocument.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/FlowDocument.xaml
new file mode 100644
index 00000000..fb68965c
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/FlowDocument.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Frame.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Frame.xaml
new file mode 100644
index 00000000..7a75a2e7
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Frame.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Net_GE45/HandyControl_Net_GE45/Themes/Styles/Growl.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml
similarity index 81%
rename from src/Net_GE45/HandyControl_Net_GE45/Themes/Styles/Growl.xaml
rename to src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml
index d28b4fa2..0d11a4e3 100644
--- a/src/Net_GE45/HandyControl_Net_GE45/Themes/Styles/Growl.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml
@@ -10,6 +10,17 @@
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/ImageViewer.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/ImageViewer.xaml
index 75b651c9..9b18b384 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/ImageViewer.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/ImageViewer.xaml
@@ -63,13 +63,7 @@
-
-
-
-
-
-
-
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/NavigationWindow.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/NavigationWindow.xaml
new file mode 100644
index 00000000..8105ce9e
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/NavigationWindow.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Notification.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Notification.xaml
new file mode 100644
index 00000000..04559201
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Notification.xaml
@@ -0,0 +1,22 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/PinBox.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/PinBox.xaml
new file mode 100644
index 00000000..1ad0f94d
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/PinBox.xaml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Poptip.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Poptip.xaml
new file mode 100644
index 00000000..c0162f78
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Poptip.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/ProgressBar.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/ProgressBar.xaml
index dba2c685..cb21a15c 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/ProgressBar.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/ProgressBar.xaml
@@ -1,6 +1,7 @@
+ xmlns:controls="clr-namespace:HandyControl.Controls"
+ xmlns:system="clr-namespace:System;assembly=mscorlib">
@@ -42,8 +43,8 @@
-
-
+
+
@@ -72,8 +73,8 @@
-
-
+
+
@@ -102,8 +103,8 @@
-
-
+
+
@@ -132,8 +133,8 @@
-
-
+
+
@@ -162,8 +163,8 @@
-
-
+
+
@@ -223,14 +224,43 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/RunningBlock.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/RunningBlock.xaml
new file mode 100644
index 00000000..68f2a7b7
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/RunningBlock.xaml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Screenshot.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Screenshot.xaml
new file mode 100644
index 00000000..9b3a0bfd
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Screenshot.xaml
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Separator.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Separator.xaml
new file mode 100644
index 00000000..f50f2ab3
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Separator.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/SplitButton.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/SplitButton.xaml
new file mode 100644
index 00000000..3e3ba2dc
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/SplitButton.xaml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Sprite.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Sprite.xaml
new file mode 100644
index 00000000..420b4883
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Sprite.xaml
@@ -0,0 +1,22 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/StatusBar.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/StatusBar.xaml
new file mode 100644
index 00000000..9f2a27b3
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/StatusBar.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ 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 bd4bbbf4..ac11aa8f 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
@@ -70,6 +70,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/TabControl.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/TabControl.xaml
index dc715ab0..73da8568 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/TabControl.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/TabControl.xaml
@@ -9,10 +9,17 @@
+
+
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/ToggleButton.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/ToggleButton.xaml
index 2c7e5ded..f694cbb1 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/ToggleButton.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/ToggleButton.xaml
@@ -264,7 +264,6 @@
-
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/ToolTip.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/ToolTip.xaml
index 7576bc2f..5af974d0 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/ToolTip.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/ToolTip.xaml
@@ -1,22 +1,9 @@
-
+
-
+
+
+
-
\ No newline at end of file
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/TransitioningContentControl.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/TransitioningContentControl.xaml
index 81fb9f6a..b9b21f96 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/TransitioningContentControl.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/TransitioningContentControl.xaml
@@ -2,106 +2,80 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Converter/Boolean2StrConverter.cs b/src/Shared/HandyControl_Shared/Tools/Converter/Boolean2StrConverter.cs
index 21d30e01..68691273 100644
--- a/src/Shared/HandyControl_Shared/Tools/Converter/Boolean2StrConverter.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Converter/Boolean2StrConverter.cs
@@ -4,7 +4,7 @@ using System.Windows.Data;
namespace HandyControl.Tools.Converter
{
- public class Boolean2StrConverter : IValueConverter
+ public class Boolean2StringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
diff --git a/src/Shared/HandyControl_Shared/Tools/Converter/ColLayoutConverter.cs b/src/Shared/HandyControl_Shared/Tools/Converter/ColLayoutConverter.cs
new file mode 100644
index 00000000..922c7a57
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Converter/ColLayoutConverter.cs
@@ -0,0 +1,160 @@
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design.Serialization;
+using System.Globalization;
+using System.Security;
+using System.Text;
+using HandyControl.Tools.Extension;
+
+namespace HandyControl.Tools.Converter
+{
+ public class ColLayoutConverter : TypeConverter
+ {
+ public override bool CanConvertFrom(ITypeDescriptorContext typeDescriptorContext, Type sourceType)
+ {
+ switch (Type.GetTypeCode(sourceType))
+ {
+ case TypeCode.Int16:
+ case TypeCode.UInt16:
+ case TypeCode.Int32:
+ case TypeCode.UInt32:
+ case TypeCode.Int64:
+ case TypeCode.UInt64:
+ case TypeCode.Single:
+ case TypeCode.Double:
+ case TypeCode.Decimal:
+ case TypeCode.String:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public override bool CanConvertTo(ITypeDescriptorContext typeDescriptorContext, Type destinationType) =>
+ destinationType == typeof(InstanceDescriptor) || destinationType == typeof(string);
+
+ public override object ConvertFrom(ITypeDescriptorContext typeDescriptorContext, CultureInfo cultureInfo, object source)
+ {
+ if (source == null) throw GetConvertFromException(null);
+
+ switch (source)
+ {
+ case string s:
+ return FromString(s, cultureInfo);
+ case double d:
+ return new ColLayout((int)d);
+ default:
+ return new ColLayout(Convert.ToInt32(source, cultureInfo));
+ }
+ }
+
+ [SecurityCritical]
+ public override object ConvertTo(ITypeDescriptorContext typeDescriptorContext, CultureInfo cultureInfo, object value, Type destinationType)
+ {
+ if (value == null) throw new ArgumentNullException(nameof(value));
+
+ if (destinationType == null) throw new ArgumentNullException(nameof(destinationType));
+
+ if (!(value is ColLayout th)) throw new ArgumentException("UnexpectedParameterType");
+
+ if (destinationType == typeof(string)) return ToString(th, cultureInfo);
+ if (destinationType == typeof(InstanceDescriptor))
+ {
+ var ci = typeof(ColLayout).GetConstructor(new[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int) });
+ return new InstanceDescriptor(ci, new object[] { th.Xs, th.Sm, th.Md, th.Lg, th.Xl, th.Xxl });
+ }
+
+ throw new ArgumentException("CannotConvertType");
+ }
+
+ private static string ToString(ColLayout th, CultureInfo cultureInfo)
+ {
+ var listSeparator = TokenizerHelper.GetNumericListSeparator(cultureInfo);
+
+ // Initial capacity [128] is an estimate based on a sum of:
+ // 72 = 6x double (twelve digits is generous for the range of values likely)
+ // 4 = 4x separator characters
+ var sb = new StringBuilder(128);
+
+ sb.Append(th.Xs.ToString(cultureInfo));
+ sb.Append(listSeparator);
+ sb.Append(th.Sm.ToString(cultureInfo));
+ sb.Append(listSeparator);
+ sb.Append(th.Md.ToString(cultureInfo));
+ sb.Append(listSeparator);
+ sb.Append(th.Lg.ToString(cultureInfo));
+ sb.Append(listSeparator);
+ sb.Append(th.Xl.ToString(cultureInfo));
+ sb.Append(listSeparator);
+ sb.Append(th.Xxl.ToString(cultureInfo));
+ return th.ToString();
+ }
+
+ private static ColLayout FromString(string s, CultureInfo cultureInfo)
+ {
+ var th = new TokenizerHelper(s, cultureInfo);
+ var lengths = new int[6];
+ var i = 0;
+
+ while (th.NextToken())
+ {
+ if (i >= 6)
+ {
+ i = 7; // Set i to a bad value.
+ break;
+ }
+
+ lengths[i] = th.GetCurrentToken().Value();
+ i++;
+ }
+
+ switch (i)
+ {
+ case 1:
+ return new ColLayout(lengths[0]);
+ case 2:
+ return new ColLayout
+ {
+ Xs = lengths[0],
+ Sm = lengths[1]
+ };
+ case 3:
+ return new ColLayout
+ {
+ Xs = lengths[0],
+ Sm = lengths[1],
+ Md = lengths[2]
+ };
+ case 4:
+ return new ColLayout
+ {
+ Xs = lengths[0],
+ Sm = lengths[1],
+ Md = lengths[2],
+ Lg = lengths[3]
+ };
+ case 5:
+ return new ColLayout
+ {
+ Xs = lengths[0],
+ Sm = lengths[1],
+ Md = lengths[2],
+ Lg = lengths[3],
+ Xl = lengths[4]
+ };
+ case 6:
+ return new ColLayout
+ {
+ Xs = lengths[0],
+ Sm = lengths[1],
+ Md = lengths[2],
+ Lg = lengths[3],
+ Xl = lengths[4],
+ Xxl = lengths[5]
+ };
+ }
+
+ throw new FormatException("InvalidStringColLayout");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Converter/Color2HexStrConverter.cs b/src/Shared/HandyControl_Shared/Tools/Converter/Color2HexStrConverter.cs
index 00a54b28..661be69c 100644
--- a/src/Shared/HandyControl_Shared/Tools/Converter/Color2HexStrConverter.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Converter/Color2HexStrConverter.cs
@@ -5,7 +5,7 @@ using System.Windows.Media;
namespace HandyControl.Tools.Converter
{
- public class Color2HexStrConverter : IValueConverter
+ public class Color2HexStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
@@ -30,11 +30,11 @@ namespace HandyControl.Tools.Converter
}
catch
{
- return new SolidColorBrush(default(Color));
+ return new SolidColorBrush(default);
}
- return new SolidColorBrush(default(Color));
+ return new SolidColorBrush(default);
}
- return new SolidColorBrush(default(Color));
+ return new SolidColorBrush(default);
}
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Converter/CornerRadiusSplitConverter.cs b/src/Shared/HandyControl_Shared/Tools/Converter/CornerRadiusSplitConverter.cs
new file mode 100644
index 00000000..a3edcc33
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Converter/CornerRadiusSplitConverter.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace HandyControl.Tools.Converter
+{
+ public class CornerRadiusSplitConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is CornerRadius cornerRadius)
+ {
+ if (parameter is string str)
+ {
+ var arr = str.Split(',');
+ if (arr.Length != 4) return cornerRadius;
+
+ return new CornerRadius(
+ arr[0].Equals("1") ? cornerRadius.TopLeft : 0,
+ arr[1].Equals("1") ? cornerRadius.TopRight : 0,
+ arr[2].Equals("1") ? cornerRadius.BottomRight : 0,
+ arr[3].Equals("1") ? cornerRadius.BottomLeft : 0);
+ }
+ }
+ return value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Tools/Converter/Double2GridLengthConverter.cs b/src/Shared/HandyControl_Shared/Tools/Converter/Double2GridLengthConverter.cs
new file mode 100644
index 00000000..f8c0b184
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Converter/Double2GridLengthConverter.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace HandyControl.Tools.Converter
+{
+ public class Double2GridLengthConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is double doubleValue)
+ {
+ if (double.IsNaN(doubleValue) || double.IsInfinity(doubleValue))
+ {
+ return new GridLength(1.0, GridUnitType.Star);
+ }
+ return new GridLength(doubleValue);
+ }
+
+ return new GridLength(0);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Tools/Converter/DoubleMinConverter.cs b/src/Shared/HandyControl_Shared/Tools/Converter/DoubleMinConverter.cs
new file mode 100644
index 00000000..3a1b2df7
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Converter/DoubleMinConverter.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using HandyControl.Tools.Extension;
+
+namespace HandyControl.Tools.Converter
+{
+ public class DoubleMinConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is double doubleValue)
+ {
+ if (parameter is string str)
+ {
+ var minValue = str.Value();
+ return doubleValue < minValue ? minValue : doubleValue;
+ }
+
+ return doubleValue < .0 ? .0 : doubleValue;
+ }
+
+ return .0;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Tools/Converter/Int2StrConverter.cs b/src/Shared/HandyControl_Shared/Tools/Converter/Int2StrConverter.cs
index 3ebfff45..9e98e746 100644
--- a/src/Shared/HandyControl_Shared/Tools/Converter/Int2StrConverter.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Converter/Int2StrConverter.cs
@@ -4,24 +4,27 @@ using System.Windows.Data;
namespace HandyControl.Tools.Converter
{
- public class Int2StrConverter : IValueConverter
+ public class Int2StringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- if (value is int intValue)
+ if (value != null)
{
- if (parameter is string str)
+ if (int.TryParse(value.ToString(), out var intValue))
{
- var arr = str.Split(';');
- if (arr.Length > intValue)
+ if (parameter is string str)
{
- return arr[intValue];
+ var arr = str.Split(';');
+ if (arr.Length > intValue)
+ {
+ return arr[intValue];
+ }
+
+ return intValue;
}
return intValue;
}
-
- return intValue;
}
return value;
diff --git a/src/Shared/HandyControl_Shared/Tools/Converter/ThicknessSplitConverter.cs b/src/Shared/HandyControl_Shared/Tools/Converter/ThicknessSplitConverter.cs
new file mode 100644
index 00000000..9e79f77f
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Converter/ThicknessSplitConverter.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace HandyControl.Tools.Converter
+{
+ public class ThicknessSplitConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is Thickness thickness)
+ {
+ if (parameter is string str)
+ {
+ var arr = str.Split(',');
+ if (arr.Length != 4) return thickness;
+
+ return new Thickness(
+ arr[0].Equals("1") ? thickness.Left : 0,
+ arr[1].Equals("1") ? thickness.Top : 0,
+ arr[2].Equals("1") ? thickness.Right : 0,
+ arr[3].Equals("1") ? thickness.Bottom : 0);
+ }
+ }
+ return value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Tools/Extension/ColLayout.cs b/src/Shared/HandyControl_Shared/Tools/Extension/ColLayout.cs
index f0573647..4db36da3 100644
--- a/src/Shared/HandyControl_Shared/Tools/Extension/ColLayout.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Extension/ColLayout.cs
@@ -1,13 +1,20 @@
using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Text;
using System.Windows.Markup;
using HandyControl.Data;
+using HandyControl.Tools.Converter;
namespace HandyControl.Tools.Extension
{
+ [TypeConverter(typeof(ColLayoutConverter))]
public class ColLayout : MarkupExtension
{
public static readonly int ColMaxCellCount = 24;
+ public static readonly int HalfColMaxCellCount = 12;
+
public static readonly int XsMaxWidth = 768;
public static readonly int SmMaxWidth = 992;
@@ -30,6 +37,31 @@ namespace HandyControl.Tools.Extension
public int Xxl { get; set; } = 2;
+ public ColLayout()
+ {
+
+ }
+
+ public ColLayout(int uniformWidth)
+ {
+ Xs = uniformWidth;
+ Sm = uniformWidth;
+ Md = uniformWidth;
+ Lg = uniformWidth;
+ Xl = uniformWidth;
+ Xxl = uniformWidth;
+ }
+
+ public ColLayout(int xs, int sm, int md, int lg, int xl, int xxl)
+ {
+ Xs = xs;
+ Sm = sm;
+ Md = md;
+ Lg = lg;
+ Xl = xl;
+ Xxl = xxl;
+ }
+
public override object ProvideValue(IServiceProvider serviceProvider)
{
return new ColLayout
@@ -67,5 +99,29 @@ namespace HandyControl.Tools.Extension
}
return ColLayoutStatus.Xxl;
}
+
+ public override string ToString()
+ {
+ var cultureInfo = CultureInfo.CurrentCulture;
+ var listSeparator = TokenizerHelper.GetNumericListSeparator(cultureInfo);
+
+ // Initial capacity [128] is an estimate based on a sum of:
+ // 72 = 6x double (twelve digits is generous for the range of values likely)
+ // 4 = 4x separator characters
+ var sb = new StringBuilder(128);
+
+ sb.Append(Xs.ToString(cultureInfo));
+ sb.Append(listSeparator);
+ sb.Append(Sm.ToString(cultureInfo));
+ sb.Append(listSeparator);
+ sb.Append(Md.ToString(cultureInfo));
+ sb.Append(listSeparator);
+ sb.Append(Lg.ToString(cultureInfo));
+ sb.Append(listSeparator);
+ sb.Append(Xl.ToString(cultureInfo));
+ sb.Append(listSeparator);
+ sb.Append(Xxl.ToString(cultureInfo));
+ return sb.ToString();
+ }
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Extension/DependencyObjectExtension.cs b/src/Shared/HandyControl_Shared/Tools/Extension/DependencyObjectExtension.cs
new file mode 100644
index 00000000..779d25bf
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Extension/DependencyObjectExtension.cs
@@ -0,0 +1,18 @@
+using System.Windows;
+using System.Windows.Media;
+
+namespace HandyControl.Tools.Extension
+{
+ public static class DependencyObjectExtension
+ {
+ public static DependencyObject GetVisualOrLogicalParent(this DependencyObject sourceElement)
+ {
+ return sourceElement switch
+ {
+ null => null,
+ Visual _ => (VisualTreeHelper.GetParent(sourceElement) ?? LogicalTreeHelper.GetParent(sourceElement)),
+ _ => LogicalTreeHelper.GetParent(sourceElement)
+ };
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Tools/Extension/EnumerableExtension.cs b/src/Shared/HandyControl_Shared/Tools/Extension/EnumerableExtension.cs
index 68232166..3d5685db 100644
--- a/src/Shared/HandyControl_Shared/Tools/Extension/EnumerableExtension.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Extension/EnumerableExtension.cs
@@ -16,5 +16,16 @@ namespace HandyControl.Tools.Extension
return enumerable;
}
+
+ public static IEnumerable DoWithIndex(this IEnumerable source, Action predicate)
+ {
+ var enumerable = source as IList ?? source.ToList();
+ for (var i = 0; i < enumerable.Count; i++)
+ {
+ predicate.Invoke(enumerable[i], i);
+ }
+
+ return enumerable;
+ }
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Extension/StringExtension.cs b/src/Shared/HandyControl_Shared/Tools/Extension/StringExtension.cs
index 854f767e..9cbe5e7a 100644
--- a/src/Shared/HandyControl_Shared/Tools/Extension/StringExtension.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Extension/StringExtension.cs
@@ -13,7 +13,7 @@ namespace HandyControl.Tools.Extension
}
catch
{
- return default(T);
+ return default;
}
}
diff --git a/src/Shared/HandyControl_Shared/Tools/GithubGravatarGenerator.cs b/src/Shared/HandyControl_Shared/Tools/Generator/GithubGravatarGenerator.cs
similarity index 100%
rename from src/Shared/HandyControl_Shared/Tools/GithubGravatarGenerator.cs
rename to src/Shared/HandyControl_Shared/Tools/Generator/GithubGravatarGenerator.cs
diff --git a/src/Shared/HandyControl_Shared/Tools/Generator/HatchBrushGenerator.cs b/src/Shared/HandyControl_Shared/Tools/Generator/HatchBrushGenerator.cs
new file mode 100644
index 00000000..d57d11ac
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Generator/HatchBrushGenerator.cs
@@ -0,0 +1,117 @@
+using System;
+using System.Windows;
+using System.Windows.Media;
+using HandyControl.Data;
+
+namespace HandyControl.Tools
+{
+ public class HatchBrushGenerator
+ {
+ private static readonly byte[][] HatchBrushes =
+ {
+ new byte[] {0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00}, // Horizontal
+ new byte[] {0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}, // Vertical
+ new byte[] {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}, // ForwardDiagonal
+ new byte[] {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}, // BackwardDiagonal
+ new byte[] {0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08}, // Cross
+ new byte[] {0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81}, // DiagonalCross
+ new byte[] {0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80}, // Percent05
+ new byte[] {0x00, 0x02, 0x00, 0x88, 0x00, 0x20, 0x00, 0x88}, // Percent10
+ new byte[] {0x00, 0x22, 0x00, 0xcc, 0x00, 0x22, 0x00, 0xcc}, // Percent20
+ new byte[] {0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc}, // Percent25
+ new byte[] {0x00, 0xcc, 0x04, 0xcc, 0x00, 0xcc, 0x40, 0xcc}, // Percent30
+ new byte[] {0x44, 0xcc, 0x22, 0xcc, 0x44, 0xcc, 0x22, 0xcc}, // Percent40
+ new byte[] {0x55, 0xcc, 0x55, 0xcc, 0x55, 0xcc, 0x55, 0xcc}, // Percent50
+ new byte[] {0x55, 0xcd, 0x55, 0xee, 0x55, 0xdc, 0x55, 0xee}, // Percent60
+ new byte[] {0x55, 0xdd, 0x55, 0xff, 0x55, 0xdd, 0x55, 0xff}, // Percent70
+ new byte[] {0x55, 0xff, 0x55, 0xff, 0x55, 0xff, 0x55, 0xff}, // Percent75
+ new byte[] {0x55, 0xff, 0x59, 0xff, 0x55, 0xff, 0x99, 0xff}, // Percent80
+ new byte[] {0x77, 0xff, 0xdd, 0xff, 0x77, 0xff, 0xfd, 0xff}, // Percent90
+ new byte[] {0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88}, // LightDownwardDiagonal
+ new byte[] {0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11}, // LightUpwardDiagonal
+ new byte[] {0x99, 0x33, 0x66, 0xcc, 0x99, 0x33, 0x66, 0xcc}, // DarkDownwardDiagonal
+ new byte[] {0xcc, 0x66, 0x33, 0x99, 0xcc, 0x66, 0x33, 0x99}, // DarkUpwardDiagonal
+ new byte[] {0xc1, 0x83, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0}, // WideDownwardDiagonal
+ new byte[] {0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x83, 0xc1}, // WideUpwardDiagonal
+ new byte[] {0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88}, // LightVertical
+ new byte[] {0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff}, // LightHorizontal
+ new byte[] {0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa}, // NarrowVertical
+ new byte[] {0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff}, // NarrowHorizontal
+ new byte[] {0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc}, // DarkVertical
+ new byte[] {0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff}, // DarkHorizontal
+ new byte[] {0x11, 0x22, 0x44, 0x88, 0x00, 0x00, 0x00, 0x00}, // DashedDownwardDiagonal
+ new byte[] {0x88, 0x44, 0x22, 0x11, 0x00, 0x00, 0x00, 0x00}, // DashedUpwardDiagonal
+ new byte[] {0x0f, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00}, // DashedHorizontal
+ new byte[] {0x01, 0x01, 0x01, 0x01, 0x10, 0x10, 0x10, 0x10}, // DashedVertical
+ new byte[] {0x01, 0x08, 0x80, 0x10, 0x02, 0x40, 0x04, 0x20}, // SmallConfetti
+ new byte[] {0x03, 0x63, 0x6c, 0x0c, 0xc0, 0xc6, 0x36, 0x30}, // LargeConfetti
+ new byte[] {0x03, 0x84, 0x48, 0x30, 0x03, 0x84, 0x48, 0x30}, // ZigZag
+ new byte[] {0x30, 0x49, 0x06, 0x00, 0x30, 0x49, 0x06, 0x00}, // Wave
+ new byte[] {0x81, 0x42, 0x24, 0x18, 0x08, 0x04, 0x02, 0x01}, // DiagonalBrick
+ new byte[] {0xff, 0x01, 0x01, 0x01, 0xff, 0x10, 0x10, 0x10}, // HorizontalBrick
+ new byte[] {0x11, 0x82, 0x44, 0xa8, 0x11, 0xa2, 0x44, 0x2a}, // Weave
+ new byte[] {0x55, 0xaa, 0x55, 0xaa, 0x0f, 0x0f, 0x0f, 0x0f}, // Plaid
+ new byte[] {0x02, 0x01, 0x02, 0x00, 0x10, 0x20, 0x10, 0x00}, // Divot
+ new byte[] {0x55, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00}, // DottedGrid
+ new byte[] {0x11, 0x00, 0x04, 0x00, 0x11, 0x00, 0x40, 0x00}, // DottedDiamond
+ new byte[] {0x03, 0x0c, 0x10, 0x20, 0x20, 0x30, 0x48, 0x84}, // Shingle
+ new byte[] {0xff, 0x33, 0xff, 0xcc, 0xff, 0x33, 0xff, 0xcc}, // Trellis
+ new byte[] {0xee, 0x19, 0x1f, 0x1f, 0xee, 0x91, 0xf1, 0xf1}, // Sphere
+ new byte[] {0xff, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11}, // SmallGrid
+ new byte[] {0x33, 0x33, 0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc}, // SmallCheckerBoard
+ new byte[] {0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0}, // LargeCheckerBoard
+ new byte[] {0x01, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82}, // OutlinedDiamond
+ new byte[] {0x08, 0x1c, 0x3e, 0x7f, 0x3e, 0x1c, 0x08, 0x00} // SolidDiamond
+ };
+
+ public Brush GetHatchBrush(HatchStyle hatchStyle, Color foreColor, Color backColor)
+ {
+ var hatchData = GetHatchData(hatchStyle);
+
+ var foreGeometryGroup = new GeometryGroup();
+
+ for (var y = 0; y < 8; y++)
+ {
+ for (var x = 0; x < 8; x++)
+ {
+ if ((hatchData[y] & (0x80 >> x)) > 0)
+ {
+ foreGeometryGroup.Children.Add(new RectangleGeometry(new Rect(x, y, 1, 1)));
+ }
+ }
+ }
+
+ var drawingBrush = new DrawingBrush
+ {
+ Viewport = new Rect(0, 0, 8, 8),
+ ViewportUnits = BrushMappingMode.Absolute,
+ Stretch = Stretch.None,
+ TileMode = TileMode.Tile,
+ Drawing = new DrawingGroup
+ {
+ Children =
+ {
+ new GeometryDrawing
+ {
+ Brush = new SolidColorBrush(backColor),
+ Geometry = new RectangleGeometry(new Rect(0, 0, 8, 8))
+ },
+ new GeometryDrawing
+ {
+ Brush = new SolidColorBrush(foreColor),
+ Geometry = foreGeometryGroup
+ }
+ }
+ }
+ };
+ RenderOptions.SetCachingHint(drawingBrush, CachingHint.Cache);
+
+ return drawingBrush;
+ }
+
+ private byte[] GetHatchData(HatchStyle hatchStyle) =>
+ hatchStyle < HatchStyle.Horizontal || hatchStyle > HatchStyle.SolidDiamond
+ ? throw new ArgumentOutOfRangeException(nameof(hatchStyle))
+ : HatchBrushes[(int)hatchStyle];
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Tools/GlobalShortcut.cs b/src/Shared/HandyControl_Shared/Tools/GlobalShortcut.cs
index 3946d575..2bb4d72e 100644
--- a/src/Shared/HandyControl_Shared/Tools/GlobalShortcut.cs
+++ b/src/Shared/HandyControl_Shared/Tools/GlobalShortcut.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Windows;
@@ -18,7 +17,6 @@ namespace HandyControl.Tools
static GlobalShortcut()
{
-
KeyboardHook.KeyDown += KeyboardHook_KeyDown;
}
@@ -51,21 +49,6 @@ namespace HandyControl.Tools
key == Key.RightCtrl || key == Key.RightAlt || key == Key.RightShift || key == Key.RWin;
}
- [Obsolete("pls use Host attach property instead of Init method")]
- public static void Init(DependencyObject host)
- {
- CommandDic.Clear();
-
- if (host == null) return;
-
- KeyBindingCollection = GetKeyBindings(host);
- if (KeyBindingCollection == null || KeyBindingCollection.Count == 0) return;
-
- AddKeyBindings(KeyBindingCollection);
-
- KeyboardHook.Start();
- }
-
private static void AddKeyBindings(IEnumerable keyBindings)
{
foreach (var item in keyBindings)
diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/AnimationHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/AnimationHelper.cs
index feeb9cce..851a8dc1 100644
--- a/src/Shared/HandyControl_Shared/Tools/Helper/AnimationHelper.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Helper/AnimationHelper.cs
@@ -1,6 +1,10 @@
using System;
+using System.Text;
+using System.Text.RegularExpressions;
using System.Windows;
+using System.Windows.Media;
using System.Windows.Media.Animation;
+using HandyControl.Tools.Extension;
namespace HandyControl.Tools
{
@@ -15,7 +19,7 @@ namespace HandyControl.Tools
///
///
///
- public static ThicknessAnimation CreateAnimation(Thickness thickness = default(Thickness), double milliseconds = 200)
+ public static ThicknessAnimation CreateAnimation(Thickness thickness = default, double milliseconds = 200)
{
return new ThicknessAnimation(thickness, new Duration(TimeSpan.FromMilliseconds(milliseconds)))
{
@@ -36,5 +40,55 @@ namespace HandyControl.Tools
EasingFunction = new PowerEase { EasingMode = EasingMode.EaseInOut }
};
}
+
+ internal static void DecomposeGeometryStr(string geometryStr, out double[] arr)
+ {
+ var collection = Regex.Matches(geometryStr, RegularPatterns.DigitsPattern);
+ arr = new double[collection.Count];
+ for (var i = 0; i < collection.Count; i++)
+ {
+ arr[i] = collection[i].Value.Value();
+ }
+ }
+
+ internal static Geometry ComposeGeometry(string[] strings, double[] arr)
+ {
+ var builder = new StringBuilder(strings[0]);
+ for (var i = 0; i < arr.Length; i++)
+ {
+ var s = strings[i + 1];
+ var n = arr[i];
+ if (!double.IsNaN(n))
+ {
+ builder.Append(n).Append(s);
+ }
+ }
+
+ return Geometry.Parse(builder.ToString());
+ }
+
+ internal static Geometry InterpolateGeometry(double[] from, double[] to, double progress, string[] strings)
+ {
+ var accumulated = new double[to.Length];
+ for (var i = 0; i < to.Length; i++)
+ {
+ var fromValue = from[i];
+ accumulated[i] = fromValue + (to[i] - fromValue) * progress;
+ }
+
+ return ComposeGeometry(strings, accumulated);
+ }
+
+ internal static double[] InterpolateGeometryValue(double[] from, double[] to, double progress)
+ {
+ var accumulated = new double[to.Length];
+ for (var i = 0; i < to.Length; i++)
+ {
+ var fromValue = from[i];
+ accumulated[i] = fromValue + (to[i] - fromValue) * progress;
+ }
+
+ return accumulated;
+ }
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/ConfigHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/ConfigHelper.cs
index 915f0869..55051127 100644
--- a/src/Shared/HandyControl_Shared/Tools/Helper/ConfigHelper.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Helper/ConfigHelper.cs
@@ -6,6 +6,8 @@ using System.Runtime.CompilerServices;
#endif
using System.Windows;
using System.Windows.Markup;
+using System.Windows.Media.Animation;
+using System.Windows.Navigation;
using HandyControl.Controls;
using HandyControl.Data;
@@ -50,6 +52,28 @@ namespace HandyControl.Tools
{
SetSystemVersionInfo(config.SystemVersionInfo);
SetLang(config.Lang);
+ SetTimelineFrameRate(config.TimelineFrameRate);
+ }
+
+ public void SetTimelineFrameRate(int rate) =>
+ Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata(rate));
+
+ public void SetWindowDefaultStyle(object resourceKey = null)
+ {
+ var metadata = resourceKey == null
+ ? new FrameworkPropertyMetadata(Application.Current.FindResource(typeof(System.Windows.Window)))
+ : new FrameworkPropertyMetadata(Application.Current.FindResource(resourceKey));
+
+ FrameworkElement.StyleProperty.OverrideMetadata(typeof(System.Windows.Window), metadata);
+ }
+
+ public void SetNavigationWindowDefaultStyle(object resourceKey = null)
+ {
+ var metadata = resourceKey == null
+ ? new FrameworkPropertyMetadata(Application.Current.FindResource(typeof(NavigationWindow)))
+ : new FrameworkPropertyMetadata(Application.Current.FindResource(resourceKey));
+
+ FrameworkElement.StyleProperty.OverrideMetadata(typeof(NavigationWindow), metadata);
}
public event PropertyChangedEventHandler PropertyChanged;
@@ -66,4 +90,4 @@ namespace HandyControl.Tools
}
#endif
}
-}
\ No newline at end of file
+}
diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/CreateParams.cs b/src/Shared/HandyControl_Shared/Tools/Helper/CreateParams.cs
deleted file mode 100644
index 03f4d550..00000000
--- a/src/Shared/HandyControl_Shared/Tools/Helper/CreateParams.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using System;
-using System.Text;
-
-namespace HandyControl.Tools
-{
- internal class CreateParams
- {
- public string ClassName { get; set; }
-
- public string Caption { get; set; }
-
- public int Style { get; set; }
-
- public int ExStyle{ get; set; }
-
- public int ClassStyle { get; set; }
-
- public int X { get; set; }
-
- public int Y { get; set; }
-
- public int Width { get; set; }
-
- public int Height { get; set; }
-
- public IntPtr Parent { get; set; }
-
- public object Param { get; set; }
-
- public override string ToString()
- {
- var sb = new StringBuilder(64);
- sb.Append("CreateParams {'");
- sb.Append(ClassName);
- sb.Append("', '");
- sb.Append(Caption);
- sb.Append("', 0x");
- sb.Append(Convert.ToString(Style, 16));
- sb.Append(", 0x");
- sb.Append(Convert.ToString(ExStyle, 16));
- sb.Append(", {");
- sb.Append(X);
- sb.Append(", ");
- sb.Append(Y);
- sb.Append(", ");
- sb.Append(Width);
- sb.Append(", ");
- sb.Append(Height);
- sb.Append("}");
- sb.Append("}");
- return sb.ToString();
- }
- }
-}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/DpiHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/DpiHelper.cs
index 76134f6a..d7669756 100644
--- a/src/Shared/HandyControl_Shared/Tools/Helper/DpiHelper.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Helper/DpiHelper.cs
@@ -1,14 +1,54 @@
using System;
using System.Windows;
using System.Windows.Media;
+using HandyControl.Tools.Interop;
namespace HandyControl.Tools
{
- internal class DpiHelper
+ internal static class DpiHelper
{
- [ThreadStatic]
+ private const double LogicalDpi = 96.0;
+
+ [ThreadStatic]
private static Matrix _transformToDip;
+ static DpiHelper()
+ {
+ var dC = InteropMethods.GetDC(IntPtr.Zero);
+ if (dC != IntPtr.Zero)
+ {
+ DeviceDpiX = InteropMethods.GetDeviceCaps(dC, 88);
+ DeviceDpiY = InteropMethods.GetDeviceCaps(dC, 90);
+ InteropMethods.ReleaseDC(IntPtr.Zero, dC);
+ }
+ else
+ {
+ DeviceDpiX = LogicalDpi;
+ DeviceDpiY = LogicalDpi;
+ }
+
+ var identity = Matrix.Identity;
+ var identity2 = Matrix.Identity;
+ identity.Scale(DeviceDpiX / LogicalDpi, DeviceDpiY / LogicalDpi);
+ identity2.Scale(LogicalDpi / DeviceDpiX, LogicalDpi / DeviceDpiY);
+ TransformFromDevice = new MatrixTransform(identity2);
+ TransformFromDevice.Freeze();
+ TransformToDevice = new MatrixTransform(identity);
+ TransformToDevice.Freeze();
+ }
+
+ public static MatrixTransform TransformFromDevice { get; }
+
+ public static MatrixTransform TransformToDevice { get; }
+
+ public static double DeviceDpiX { get; }
+
+ public static double DeviceDpiY { get; }
+
+ public static double LogicalToDeviceUnitsScalingFactorX => TransformToDevice.Matrix.M11;
+
+ public static double LogicalToDeviceUnitsScalingFactorY => TransformToDevice.Matrix.M22;
+
public static Point DevicePixelsToLogical(Point devicePoint, double dpiScaleX, double dpiScaleY)
{
_transformToDip = Matrix.Identity;
@@ -18,9 +58,22 @@ namespace HandyControl.Tools
public static Size DeviceSizeToLogical(Size deviceSize, double dpiScaleX, double dpiScaleY)
{
- Point pt = DevicePixelsToLogical(new Point(deviceSize.Width, deviceSize.Height), dpiScaleX, dpiScaleY);
-
+ var pt = DevicePixelsToLogical(new Point(deviceSize.Width, deviceSize.Height), dpiScaleX, dpiScaleY);
return new Size(pt.X, pt.Y);
}
+
+ public static Rect LogicalToDeviceUnits(this Rect logicalRect)
+ {
+ var result = logicalRect;
+ result.Transform(TransformToDevice.Matrix);
+ return result;
+ }
+
+ public static Rect DeviceToLogicalUnits(this Rect deviceRect)
+ {
+ var result = deviceRect;
+ result.Transform(TransformFromDevice.Matrix);
+ return result;
+ }
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/IconHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/IconHelper.cs
index 225302dd..f5f1bfb4 100644
--- a/src/Shared/HandyControl_Shared/Tools/Helper/IconHelper.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Helper/IconHelper.cs
@@ -79,13 +79,13 @@ namespace HandyControl.Tools
try
{
- var bi = new BITMAPINFO(width, -height, 32)
+ var bi = new InteropValues.BITMAPINFO(width, -height, 32)
{
- bmiHeader_biCompression = NativeMethods.BI_RGB
+ biCompression = InteropValues.BI_RGB
};
var bits = IntPtr.Zero;
- colorBitmap = UnsafeNativeMethods.CreateDIBSection(new HandleRef(null, IntPtr.Zero), ref bi, NativeMethods.DIB_RGB_COLORS, ref bits, null, 0);
+ colorBitmap = InteropMethods.CreateDIBSection(new HandleRef(null, IntPtr.Zero), ref bi, InteropValues.DIB_RGB_COLORS, ref bits, null, 0);
if (colorBitmap.IsInvalid || bits == IntPtr.Zero)
{
@@ -95,13 +95,13 @@ namespace HandyControl.Tools
Marshal.Copy(colorArray, 0, bits, colorArray.Length);
var maskArray = GenerateMaskArray(width, height, colorArray);
- maskBitmap = UnsafeNativeMethods.CreateBitmap(width, height, 1, 1, maskArray);
+ maskBitmap = InteropMethods.CreateBitmap(width, height, 1, 1, maskArray);
if (maskBitmap.IsInvalid)
{
return IconHandle.GetInvalidIcon();
}
- var iconInfo = new ICONINFO
+ var iconInfo = new InteropValues.ICONINFO
{
fIcon = isIcon,
xHotspot = xHotspot,
@@ -110,7 +110,7 @@ namespace HandyControl.Tools
hbmColor = colorBitmap
};
- return UnsafeNativeMethods.CreateIconIndirect(iconInfo);
+ return InteropMethods.CreateIconIndirect(iconInfo);
}
finally
{
@@ -252,21 +252,21 @@ namespace HandyControl.Tools
{
if (SystemBitDepth == 0)
{
- var hdcDesktop = new HandleRef(null, UnsafeNativeMethods.GetDC(new HandleRef()));
+ var hdcDesktop = new HandleRef(null, InteropMethods.GetDC(new HandleRef()));
try
{
- var sysBitDepth = UnsafeNativeMethods.GetDeviceCaps(hdcDesktop, NativeMethods.BITSPIXEL);
- sysBitDepth *= UnsafeNativeMethods.GetDeviceCaps(hdcDesktop, NativeMethods.PLANES);
+ var sysBitDepth = InteropMethods.GetDeviceCaps(hdcDesktop, InteropValues.BITSPIXEL);
+ sysBitDepth *= InteropMethods.GetDeviceCaps(hdcDesktop, InteropValues.PLANES);
if (sysBitDepth == 8)
{
sysBitDepth = 4;
}
- var cxSmallIcon = UnsafeNativeMethods.GetSystemMetrics(SM.CXSMICON);
- var cySmallIcon = UnsafeNativeMethods.GetSystemMetrics(SM.CYSMICON);
- var cxIcon = UnsafeNativeMethods.GetSystemMetrics(SM.CXICON);
- var cyIcon = UnsafeNativeMethods.GetSystemMetrics(SM.CYICON);
+ var cxSmallIcon = InteropMethods.GetSystemMetrics(InteropValues.SM.CXSMICON);
+ var cySmallIcon = InteropMethods.GetSystemMetrics(InteropValues.SM.CYSMICON);
+ var cxIcon = InteropMethods.GetSystemMetrics(InteropValues.SM.CXICON);
+ var cyIcon = InteropMethods.GetSystemMetrics(InteropValues.SM.CYICON);
SmallIconSize = new Size(cxSmallIcon, cySmallIcon);
IconSize = new Size(cxIcon, cyIcon);
@@ -274,7 +274,7 @@ namespace HandyControl.Tools
}
finally
{
- UnsafeNativeMethods.ReleaseDC(new HandleRef(), hdcDesktop);
+ InteropMethods.ReleaseDC(new HandleRef(), hdcDesktop);
}
}
}
@@ -287,8 +287,8 @@ namespace HandyControl.Tools
SecurityHelper.DemandUIWindowPermission();
- var iconModuleFile = UnsafeNativeMethods.GetModuleFileName(new HandleRef());
- UnsafeNativeMethods.ExtractIconEx(iconModuleFile, 0, out largeIconHandle, out smallIconHandle, 1);
+ var iconModuleFile = InteropMethods.GetModuleFileName(new HandleRef());
+ InteropMethods.ExtractIconEx(iconModuleFile, 0, out largeIconHandle, out smallIconHandle, 1);
}
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/ResourceHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/ResourceHelper.cs
index 1cde8a3d..a7518c02 100644
--- a/src/Shared/HandyControl_Shared/Tools/Helper/ResourceHelper.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Helper/ResourceHelper.cs
@@ -47,7 +47,7 @@ namespace HandyControl.Tools
return resource;
}
- return default(T);
+ return default;
}
///
diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/ScreenHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/ScreenHelper.cs
new file mode 100644
index 00000000..9bcfab2f
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Helper/ScreenHelper.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Windows;
+using HandyControl.Tools.Interop;
+
+namespace HandyControl.Tools
+{
+ internal class ScreenHelper
+ {
+ internal static void FindMaximumSingleMonitorRectangle(Rect windowRect, out Rect screenSubRect, out Rect monitorRect)
+ {
+ var windowRect2 = new InteropValues.RECT(windowRect);
+ FindMaximumSingleMonitorRectangle(windowRect2, out var rect, out var rect2);
+ screenSubRect = new Rect(rect.Position, rect.Size);
+ monitorRect = new Rect(rect2.Position, rect2.Size);
+ }
+
+ private static void FindMaximumSingleMonitorRectangle(InteropValues.RECT windowRect, out InteropValues.RECT screenSubRect, out InteropValues.RECT monitorRect)
+ {
+ var rects = new List();
+ InteropMethods.EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero,
+ delegate(IntPtr hMonitor, IntPtr hdcMonitor, ref InteropValues.RECT rect, IntPtr lpData)
+ {
+ var monitorInfo = default(InteropValues.MONITORINFO);
+ monitorInfo.cbSize = (uint) Marshal.SizeOf(typeof(InteropValues.MONITORINFO));
+ InteropMethods.GetMonitorInfo(hMonitor, ref monitorInfo);
+ rects.Add(monitorInfo.rcWork);
+ return true;
+ }, IntPtr.Zero);
+
+ var num = 0L;
+
+ screenSubRect = new InteropValues.RECT
+ {
+ Left = 0,
+ Right = 0,
+ Top = 0,
+ Bottom = 0
+ };
+
+ monitorRect = new InteropValues.RECT
+ {
+ Left = 0,
+ Right = 0,
+ Top = 0,
+ Bottom = 0
+ };
+
+ foreach (var current in rects)
+ {
+ var rect = current;
+ InteropMethods.IntersectRect(out var rECT2, ref rect, ref windowRect);
+ var num2 = (long) (rECT2.Width * rECT2.Height);
+ if (num2 > num)
+ {
+ screenSubRect = rECT2;
+ monitorRect = current;
+ num = num2;
+ }
+ }
+ }
+
+ internal static void FindMonitorRectsFromPoint(Point point, out Rect monitorRect, out Rect workAreaRect)
+ {
+ var intPtr = InteropMethods.MonitorFromPoint(new InteropValues.POINT
+ {
+ X = (int) point.X,
+ Y = (int) point.Y
+ }, 2);
+
+ monitorRect = new Rect(0.0, 0.0, 0.0, 0.0);
+ workAreaRect = new Rect(0.0, 0.0, 0.0, 0.0);
+
+ if (intPtr != IntPtr.Zero)
+ {
+ InteropValues.MONITORINFO monitorInfo = default;
+ monitorInfo.cbSize = (uint) Marshal.SizeOf(typeof(InteropValues.MONITORINFO));
+ InteropMethods.GetMonitorInfo(intPtr, ref monitorInfo);
+ monitorRect = new Rect(monitorInfo.rcMonitor.Position, monitorInfo.rcMonitor.Size);
+ workAreaRect = new Rect(monitorInfo.rcWork.Position, monitorInfo.rcWork.Size);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/SingleOpenHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/SingleOpenHelper.cs
index 49a6c875..f8594ac1 100644
--- a/src/Shared/HandyControl_Shared/Tools/Helper/SingleOpenHelper.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Helper/SingleOpenHelper.cs
@@ -21,7 +21,7 @@ namespace HandyControl.Tools
{
var typeStr = typeof(T).FullName;
- if (string.IsNullOrEmpty(typeStr)) return default(T);
+ if (string.IsNullOrEmpty(typeStr)) return default;
var temp = new T();
if (!OpenDic.Keys.Contains(typeStr))
@@ -36,7 +36,7 @@ namespace HandyControl.Tools
OpenDic[typeStr] = temp;
return temp;
}
- return default(T);
+ return default;
}
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/TokenizerHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/TokenizerHelper.cs
new file mode 100644
index 00000000..2911bf39
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Helper/TokenizerHelper.cs
@@ -0,0 +1,233 @@
+//---------------------------------------------------------------------------
+//
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//
+// File: TokenizerHelper.cs
+//
+// Description: This file contains the implementation of TokenizerHelper.
+// This class should be used by most - if not all - MIL parsers.
+//
+// History:
+// 05/19/2003 : Microsoft - Created it
+// 05/20/2003 : Microsoft - Moved to Shared
+//
+//---------------------------------------------------------------------------
+
+using System;
+using System.Globalization;
+
+namespace HandyControl.Tools
+{
+ internal class TokenizerHelper
+ {
+ private char _quoteChar;
+
+ private char _argSeparator;
+
+ private string _str;
+
+ private int _strLen;
+
+ private int _charIndex;
+
+ private int _currentTokenIndex;
+
+ private int _currentTokenLength;
+
+ public bool FoundSeparator { get; private set; }
+
+ public TokenizerHelper(string str, IFormatProvider formatProvider)
+ {
+ var numberSeparator = GetNumericListSeparator(formatProvider);
+ Initialize(str, '\'', numberSeparator);
+ }
+
+ private void Initialize(string str, char quoteChar, char separator)
+ {
+ _str = str;
+ _strLen = str?.Length ?? 0;
+ _currentTokenIndex = -1;
+ _quoteChar = quoteChar;
+ _argSeparator = separator;
+
+ // immediately forward past any whitespace so
+ // NextToken() logic always starts on the first
+ // character of the next token.
+ while (_charIndex < _strLen)
+ {
+ if (!char.IsWhiteSpace(_str, _charIndex))
+ {
+ break;
+ }
+
+ ++_charIndex;
+ }
+ }
+
+ public string GetCurrentToken() =>
+ _currentTokenIndex < 0 ? null : _str.Substring(_currentTokenIndex, _currentTokenLength);
+
+ internal bool NextToken() => NextToken(false);
+
+ public bool NextToken(bool allowQuotedToken) => NextToken(allowQuotedToken, _argSeparator);
+
+ public bool NextToken(bool allowQuotedToken, char separator)
+ {
+ _currentTokenIndex = -1; // reset the currentTokenIndex
+ FoundSeparator = false; // reset
+
+ // If we're at end of the string, just return false.
+ if (_charIndex >= _strLen)
+ {
+ return false;
+ }
+
+ var currentChar = _str[_charIndex];
+
+ // setup the quoteCount
+ var quoteCount = 0;
+
+ // If we are allowing a quoted token and this token begins with a quote,
+ // set up the quote count and skip the initial quote
+ if (allowQuotedToken &&
+ currentChar == _quoteChar)
+ {
+ quoteCount++; // increment quote count
+ ++_charIndex; // move to next character
+ }
+
+ var newTokenIndex = _charIndex;
+ var newTokenLength = 0;
+
+ // loop until hit end of string or hit a , or whitespace
+ // if at end of string ust return false.
+ while (_charIndex < _strLen)
+ {
+ currentChar = _str[_charIndex];
+
+ // if have a QuoteCount and this is a quote
+ // decrement the quoteCount
+ if (quoteCount > 0)
+ {
+ // if anything but a quoteChar we move on
+ if (currentChar == _quoteChar)
+ {
+ --quoteCount;
+
+ // if at zero which it always should for now
+ // break out of the loop
+ if (0 == quoteCount)
+ {
+ ++_charIndex; // move past the quote
+ break;
+ }
+ }
+ }
+ else if (char.IsWhiteSpace(currentChar) || currentChar == separator)
+ {
+ if (currentChar == separator)
+ {
+ FoundSeparator = true;
+ }
+ break;
+ }
+
+ ++_charIndex;
+ ++newTokenLength;
+ }
+
+ // if quoteCount isn't zero we hit the end of the string
+ // before the ending quote
+ if (quoteCount > 0)
+ {
+ throw new InvalidOperationException("TokenizerHelperMissingEndQuote");
+ }
+
+ ScanToNextToken(separator); // move so at the start of the nextToken for next call
+
+ // finally made it, update the _currentToken values
+ _currentTokenIndex = newTokenIndex;
+ _currentTokenLength = newTokenLength;
+
+ if (_currentTokenLength < 1)
+ {
+ throw new InvalidOperationException("TokenizerHelperEmptyToken");
+ }
+
+ return true;
+ }
+
+ private void ScanToNextToken(char separator)
+ {
+ // if already at end of the string don't bother
+ if (_charIndex >= _strLen) return;
+
+ var currentChar = _str[_charIndex];
+
+ // check that the currentChar is a space or the separator. If not
+ // we have an error. this can happen in the quote case
+ // that the char after the quotes string isn't a char.
+ if (currentChar != separator && !char.IsWhiteSpace(currentChar))
+ {
+ throw new InvalidOperationException("TokenizerHelperExtraDataEncountered");
+ }
+
+ // loop until hit a character that isn't
+ // an argument separator or whitespace.
+ // !!!Todo: if more than one argSet throw an exception
+ var argSepCount = 0;
+ while (_charIndex < _strLen)
+ {
+ currentChar = _str[_charIndex];
+
+ if (currentChar == separator)
+ {
+ FoundSeparator = true;
+ ++argSepCount;
+ _charIndex++;
+
+ if (argSepCount > 1)
+ {
+ throw new InvalidOperationException("TokenizerHelperEmptyToken");
+ }
+ }
+ else if (char.IsWhiteSpace(currentChar))
+ {
+ ++_charIndex;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ // if there was a separatorChar then we shouldn't be
+ // at the end of string or means there was a separator
+ // but there isn't an arg
+
+ if (argSepCount > 0 && _charIndex >= _strLen)
+ {
+ throw new InvalidOperationException("TokenizerHelperEmptyToken");
+ }
+ }
+
+ internal static char GetNumericListSeparator(IFormatProvider provider)
+ {
+ var numericSeparator = ',';
+
+ // Get the NumberFormatInfo out of the provider, if possible
+ // If the IFormatProvider doesn't not contain a NumberFormatInfo, then
+ // this method returns the current culture's NumberFormatInfo.
+ var numberFormat = NumberFormatInfo.GetInstance(provider);
+
+ // Is the decimal separator is the same as the list separator?
+ // If so, we use the ";".
+ if (numberFormat.NumberDecimalSeparator.Length > 0 && numericSeparator == numberFormat.NumberDecimalSeparator[0])
+ {
+ numericSeparator = ';';
+ }
+
+ return numericSeparator;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/VisualHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/VisualHelper.cs
index 715e02ca..b6351478 100644
--- a/src/Shared/HandyControl_Shared/Tools/Helper/VisualHelper.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Helper/VisualHelper.cs
@@ -1,25 +1,18 @@
using System;
-using System.Collections;
-using System.ComponentModel;
using System.Linq;
-using System.Runtime.InteropServices;
-using System.Security;
using System.Windows;
+using System.Windows.Interop;
using System.Windows.Media;
using HandyControl.Tools.Interop;
-using HandyControl.Tools.Extension;
namespace HandyControl.Tools
{
- public class VisualHelper
+ public static class VisualHelper
{
internal static VisualStateGroup TryGetVisualStateGroup(DependencyObject d, string groupName)
{
var root = GetImplementationRoot(d);
- if (root == null)
- {
- return null;
- }
+ if (root == null) return null;
return VisualStateManager
.GetVisualStateGroups(root)?
@@ -34,12 +27,9 @@ namespace HandyControl.Tools
: null;
}
- internal static T GetChild(DependencyObject d) where T : DependencyObject
+ public static T GetChild(DependencyObject d) where T : DependencyObject
{
- if (d is T t)
- {
- return t;
- }
+ if (d is T t) return t;
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(d); i++)
{
@@ -52,136 +42,34 @@ namespace HandyControl.Tools
return default;
}
- ///
- /// 获取当前应用中处于激活的一个窗口
- ///
- ///
- public static Window GetActiveWindow() => Application.Current.Windows.OfType().SingleOrDefault(x => x.IsActive);
-
- private static readonly BitArray _cacheValid = new BitArray((int)CacheSlot.NumSlots);
-
- private static bool _setDpiX = true;
-
- private static bool _dpiInitialized;
-
- private static readonly object _dpiLock = new object();
-
- private static int _dpi;
-
- internal static int Dpi
+ public static IntPtr GetHandle(this Visual visual)
{
- [SecurityCritical, SecuritySafeCritical]
- get
- {
- if (!_dpiInitialized)
- {
- lock (_dpiLock)
- {
- if (!_dpiInitialized)
- {
- var desktopWnd = new HandleRef(null, IntPtr.Zero);
-
- // Win32Exception will get the Win32 error code so we don't have to
- var dc = UnsafeNativeMethods.GetDC(desktopWnd);
-
- // Detecting error case from unmanaged call, required by PREsharp to throw a Win32Exception
- if (dc == IntPtr.Zero)
- {
- throw new Win32Exception();
- }
-
- try
- {
- _dpi = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(null, dc), NativeMethods.LOGPIXELSY);
- _dpiInitialized = true;
- }
- finally
- {
- UnsafeNativeMethods.ReleaseDC(desktopWnd, new HandleRef(null, dc));
- }
- }
- }
- }
- return _dpi;
- }
+ return (PresentationSource.FromVisual(visual) as HwndSource)?.Handle ?? IntPtr.Zero;
}
- private static int _dpiX;
-
- internal static int DpiX
+ internal static void HitTestVisibleElements(Visual visual, HitTestResultCallback resultCallback,
+ HitTestParameters parameters)
{
- [SecurityCritical, SecuritySafeCritical]
- get
- {
- if (_setDpiX)
- {
- lock (_cacheValid)
- {
- if (_setDpiX)
- {
- _setDpiX = false;
- var desktopWnd = new HandleRef(null, IntPtr.Zero);
- var dc = UnsafeNativeMethods.GetDC(desktopWnd);
- if (dc == IntPtr.Zero)
- {
- throw new Win32Exception();
- }
- try
- {
- _dpiX = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(null, dc), NativeMethods.LOGPIXELSX);
- _cacheValid[(int)CacheSlot.DpiX] = true;
- }
- finally
- {
- UnsafeNativeMethods.ReleaseDC(desktopWnd, new HandleRef(null, dc));
- }
- }
- }
- }
-
- return _dpiX;
- }
+ VisualTreeHelper.HitTest(visual, ExcludeNonVisualElements, resultCallback, parameters);
}
- private static Thickness _windowResizeBorderThickness;
-
- internal static Thickness WindowResizeBorderThickness
+ private static HitTestFilterBehavior ExcludeNonVisualElements(DependencyObject potentialHitTestTarget)
{
- [SecurityCritical]
- get
- {
- lock (_cacheValid)
- {
- while (!_cacheValid[(int)CacheSlot.WindowResizeBorderThickness])
- {
- _cacheValid[(int)CacheSlot.WindowResizeBorderThickness] = true;
+ if (!(potentialHitTestTarget is Visual)) return HitTestFilterBehavior.ContinueSkipSelfAndChildren;
- var frameSize = new Size(NativeMethods.GetSystemMetrics(SM.CXSIZEFRAME), NativeMethods.GetSystemMetrics(SM.CYSIZEFRAME));
- var frameSizeInDips = DpiHelper.DeviceSizeToLogical(frameSize, DpiX / 96.0, Dpi / 96.0);
+ if (!(potentialHitTestTarget is UIElement uIElement) || uIElement.IsVisible && uIElement.IsEnabled)
+ return HitTestFilterBehavior.Continue;
- _windowResizeBorderThickness = new Thickness(frameSizeInDips.Width, frameSizeInDips.Height, frameSizeInDips.Width, frameSizeInDips.Height);
- }
- }
-
- return _windowResizeBorderThickness;
- }
+ return HitTestFilterBehavior.ContinueSkipSelfAndChildren;
}
- public static Thickness WindowMaximizedPadding
+ internal static bool ModifyStyle(IntPtr hWnd, int styleToRemove, int styleToAdd)
{
- get
- {
-#if netle40
- return WindowResizeBorderThickness;
-#elif Core
- var hdc = UnsafeNativeMethods.GetDC(IntPtr.Zero);
- var scale = UnsafeNativeMethods.GetDeviceCaps(hdc, NativeMethods.DESKTOPVERTRES) / (float)UnsafeNativeMethods.GetDeviceCaps(hdc, NativeMethods.VERTRES);
- UnsafeNativeMethods.ReleaseDC(IntPtr.Zero, hdc);
- return WindowResizeBorderThickness.Add(new Thickness(4 * scale));
-#else
- return WindowResizeBorderThickness.Add(new Thickness(4));
-#endif
- }
+ var windowLong = InteropMethods.GetWindowLong(hWnd, InteropValues.GWL.STYLE);
+ var num = (windowLong & ~styleToRemove) | styleToAdd;
+ if (num == windowLong) return false;
+ InteropMethods.SetWindowLong(hWnd, InteropValues.GWL.STYLE, num);
+ return true;
}
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/WindowHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/WindowHelper.cs
new file mode 100644
index 00000000..23f73766
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Helper/WindowHelper.cs
@@ -0,0 +1,154 @@
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Security;
+using System.Windows;
+using System.Windows.Interop;
+using HandyControl.Tools.Extension;
+using HandyControl.Tools.Interop;
+
+namespace HandyControl.Tools
+{
+ public static class WindowHelper
+ {
+ ///
+ /// 获取当前应用中处于激活的一个窗口
+ ///
+ ///
+ public static Window GetActiveWindow() => Application.Current.Windows.OfType().SingleOrDefault(x => x.IsActive);
+
+ private static readonly BitArray _cacheValid = new BitArray((int)InteropValues.CacheSlot.NumSlots);
+
+ private static bool _setDpiX = true;
+
+ private static bool _dpiInitialized;
+
+ private static readonly object _dpiLock = new object();
+
+ private static int _dpi;
+
+ internal static int Dpi
+ {
+ [SecurityCritical, SecuritySafeCritical]
+ get
+ {
+ if (!_dpiInitialized)
+ {
+ lock (_dpiLock)
+ {
+ if (!_dpiInitialized)
+ {
+ var desktopWnd = new HandleRef(null, IntPtr.Zero);
+
+ // Win32Exception will get the Win32 error code so we don't have to
+ var dc = InteropMethods.GetDC(desktopWnd);
+
+ // Detecting error case from unmanaged call, required by PREsharp to throw a Win32Exception
+ if (dc == IntPtr.Zero)
+ {
+ throw new Win32Exception();
+ }
+
+ try
+ {
+ _dpi = InteropMethods.GetDeviceCaps(new HandleRef(null, dc), InteropValues.LOGPIXELSY);
+ _dpiInitialized = true;
+ }
+ finally
+ {
+ InteropMethods.ReleaseDC(desktopWnd, new HandleRef(null, dc));
+ }
+ }
+ }
+ }
+ return _dpi;
+ }
+ }
+
+ private static int _dpiX;
+
+ internal static int DpiX
+ {
+ [SecurityCritical, SecuritySafeCritical]
+ get
+ {
+ if (_setDpiX)
+ {
+ lock (_cacheValid)
+ {
+ if (_setDpiX)
+ {
+ _setDpiX = false;
+ var desktopWnd = new HandleRef(null, IntPtr.Zero);
+ var dc = InteropMethods.GetDC(desktopWnd);
+ if (dc == IntPtr.Zero)
+ {
+ throw new Win32Exception();
+ }
+ try
+ {
+ _dpiX = InteropMethods.GetDeviceCaps(new HandleRef(null, dc), InteropValues.LOGPIXELSX);
+ _cacheValid[(int)InteropValues.CacheSlot.DpiX] = true;
+ }
+ finally
+ {
+ InteropMethods.ReleaseDC(desktopWnd, new HandleRef(null, dc));
+ }
+ }
+ }
+ }
+
+ return _dpiX;
+ }
+ }
+
+ private static Thickness _windowResizeBorderThickness;
+
+ internal static Thickness WindowResizeBorderThickness
+ {
+ [SecurityCritical]
+ get
+ {
+ lock (_cacheValid)
+ {
+ while (!_cacheValid[(int)InteropValues.CacheSlot.WindowResizeBorderThickness])
+ {
+ _cacheValid[(int)InteropValues.CacheSlot.WindowResizeBorderThickness] = true;
+
+ var frameSize = new Size(InteropMethods.GetSystemMetrics(InteropValues.SM.CXSIZEFRAME), InteropMethods.GetSystemMetrics(InteropValues.SM.CYSIZEFRAME));
+ var frameSizeInDips = DpiHelper.DeviceSizeToLogical(frameSize, DpiX / 96.0, Dpi / 96.0);
+
+ _windowResizeBorderThickness = new Thickness(frameSizeInDips.Width, frameSizeInDips.Height, frameSizeInDips.Width, frameSizeInDips.Height);
+ }
+ }
+
+ return _windowResizeBorderThickness;
+ }
+ }
+
+ public static Thickness WindowMaximizedPadding
+ {
+ get
+ {
+#if netle40
+ return WindowResizeBorderThickness;
+#elif Core
+ var hdc = InteropMethods.GetDC(IntPtr.Zero);
+ var scale = InteropMethods.GetDeviceCaps(hdc, InteropValues.DESKTOPVERTRES) / (float)InteropMethods.GetDeviceCaps(hdc, InteropValues.VERTRES);
+ InteropMethods.ReleaseDC(IntPtr.Zero, hdc);
+ return WindowResizeBorderThickness.Add(new Thickness(4 * scale));
+#else
+ return WindowResizeBorderThickness.Add(new Thickness(4));
+#endif
+ }
+ }
+
+ public static IntPtr CreateHandle() => new WindowInteropHelper(new Window()).EnsureHandle();
+
+ public static IntPtr GetHandle(this Window window) => new WindowInteropHelper(window).EnsureHandle();
+
+ public static HwndSource GetHwndSource(this Window window) => HwndSource.FromHwnd(window.GetHandle());
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Tools/Hook/ClipboardHook.cs b/src/Shared/HandyControl_Shared/Tools/Hook/ClipboardHook.cs
new file mode 100644
index 00000000..ca85415b
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Hook/ClipboardHook.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Windows.Interop;
+using HandyControl.Tools.Interop;
+
+namespace HandyControl.Tools
+{
+ public class ClipboardHook
+ {
+ public static event Action ContentChanged;
+
+ private static HwndSource HWndSource;
+
+ private static IntPtr HookId = IntPtr.Zero;
+
+ private static int Count;
+
+ public static void Start()
+ {
+ if (HookId == IntPtr.Zero)
+ {
+ HookId = WindowHelper.CreateHandle();
+ HWndSource = HwndSource.FromHwnd(HookId);
+ if (HWndSource != null)
+ {
+ HWndSource.AddHook(WinProc);
+ InteropMethods.AddClipboardFormatListener(HookId);
+ }
+ }
+
+ if (HookId != IntPtr.Zero)
+ {
+ Count++;
+ }
+ }
+
+ public static void Stop()
+ {
+ Count--;
+ if (Count < 1)
+ {
+ HWndSource.RemoveHook(WinProc);
+ InteropMethods.RemoveClipboardFormatListener(HookId);
+
+ HookId = IntPtr.Zero;
+ }
+ }
+
+ private static IntPtr WinProc(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
+ {
+ if (msg == InteropValues.WM_CLIPBOARDUPDATE)
+ {
+ ContentChanged?.Invoke();
+ }
+ return IntPtr.Zero;
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Tools/Hook/KeyboardHook.cs b/src/Shared/HandyControl_Shared/Tools/Hook/KeyboardHook.cs
index 07ce92b6..1d3b3f0f 100644
--- a/src/Shared/HandyControl_Shared/Tools/Hook/KeyboardHook.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Hook/KeyboardHook.cs
@@ -14,43 +14,56 @@ namespace HandyControl.Tools
private static IntPtr HookId = IntPtr.Zero;
- private static readonly UnsafeNativeMethods.HookProc Proc = HookCallback;
+ private static readonly InteropValues.HookProc Proc = HookCallback;
private static int VirtualKey;
- private static readonly IntPtr KeyDownIntPtr = (IntPtr)NativeMethods.WM_KEYDOWN;
+ private static readonly IntPtr KeyDownIntPtr = (IntPtr)InteropValues.WM_KEYDOWN;
- private static readonly IntPtr KeyUpIntPtr = (IntPtr)NativeMethods.WM_KEYUP;
+ private static readonly IntPtr KeyUpIntPtr = (IntPtr)InteropValues.WM_KEYUP;
- private static readonly IntPtr SyskeyDownIntPtr = (IntPtr)NativeMethods.WM_SYSKEYDOWN;
+ private static readonly IntPtr SyskeyDownIntPtr = (IntPtr)InteropValues.WM_SYSKEYDOWN;
- private static readonly IntPtr SyskeyUpIntPtr = (IntPtr)NativeMethods.WM_SYSKEYUP;
+ private static readonly IntPtr SyskeyUpIntPtr = (IntPtr)InteropValues.WM_SYSKEYUP;
+
+ private static int Count;
public static void Start()
{
+ if (HookId == IntPtr.Zero)
+ {
+ HookId = SetHook(Proc);
+ }
+
if (HookId != IntPtr.Zero)
{
- Stop();
+ Count++;
}
- HookId = SetHook(Proc);
}
- public static void Stop() => UnsafeNativeMethods.UnhookWindowsHookEx(HookId);
-
- private static IntPtr SetHook(UnsafeNativeMethods.HookProc proc)
+ public static void Stop()
{
- using (var curProcess = Process.GetCurrentProcess())
- using (var curModule = curProcess.MainModule)
+ Count--;
+ if (Count < 1)
{
- if (curModule != null)
- {
- return UnsafeNativeMethods.SetWindowsHookEx((int)UnsafeNativeMethods.HookType.WH_KEYBOARD_LL, proc,
- UnsafeNativeMethods.GetModuleHandle(curModule.ModuleName), 0);
- }
- return IntPtr.Zero;
+ InteropMethods.UnhookWindowsHookEx(HookId);
+ HookId = IntPtr.Zero;
}
}
+ private static IntPtr SetHook(InteropValues.HookProc proc)
+ {
+ using var curProcess = Process.GetCurrentProcess();
+ using var curModule = curProcess.MainModule;
+
+ if (curModule != null)
+ {
+ return InteropMethods.SetWindowsHookEx((int)InteropValues.HookType.WH_KEYBOARD_LL, proc,
+ InteropMethods.GetModuleHandle(curModule.ModuleName), 0);
+ }
+ return IntPtr.Zero;
+ }
+
private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
{
if (nCode >= 0)
@@ -86,7 +99,7 @@ namespace HandyControl.Tools
KeyUp?.Invoke(null, new KeyboardHookEventArgs(virtualKey, true));
}
}
- return UnsafeNativeMethods.CallNextHookEx(HookId, nCode, wParam, lParam);
+ return InteropMethods.CallNextHookEx(HookId, nCode, wParam, lParam);
}
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Hook/MouseHook.cs b/src/Shared/HandyControl_Shared/Tools/Hook/MouseHook.cs
index 5405c6cf..43fbd507 100644
--- a/src/Shared/HandyControl_Shared/Tools/Hook/MouseHook.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Hook/MouseHook.cs
@@ -12,44 +12,57 @@ namespace HandyControl.Tools
private static IntPtr HookId = IntPtr.Zero;
- private static readonly UnsafeNativeMethods.HookProc Proc = HookCallback;
+ private static readonly InteropValues.HookProc Proc = HookCallback;
+
+ private static int Count;
public static void Start()
{
+ if (HookId == IntPtr.Zero)
+ {
+ HookId = SetHook(Proc);
+ }
+
if (HookId != IntPtr.Zero)
{
- Stop();
+ Count++;
}
- HookId = SetHook(Proc);
}
- public static void Stop() => UnsafeNativeMethods.UnhookWindowsHookEx(HookId);
-
- private static IntPtr SetHook(UnsafeNativeMethods.HookProc proc)
+ public static void Stop()
{
- using (var curProcess = Process.GetCurrentProcess())
- using (var curModule = curProcess.MainModule)
+ Count--;
+ if (Count < 1)
{
- if (curModule != null)
- {
- return UnsafeNativeMethods.SetWindowsHookEx((int) UnsafeNativeMethods.HookType.WH_MOUSE_LL, proc,
- UnsafeNativeMethods.GetModuleHandle(curModule.ModuleName), 0);
- }
- return IntPtr.Zero;
+ InteropMethods.UnhookWindowsHookEx(HookId);
+ HookId = IntPtr.Zero;
}
}
+ private static IntPtr SetHook(InteropValues.HookProc proc)
+ {
+ using var curProcess = Process.GetCurrentProcess();
+ using var curModule = curProcess.MainModule;
+
+ if (curModule != null)
+ {
+ return InteropMethods.SetWindowsHookEx((int)InteropValues.HookType.WH_MOUSE_LL, proc,
+ InteropMethods.GetModuleHandle(curModule.ModuleName), 0);
+ }
+ return IntPtr.Zero;
+ }
+
private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
{
- if (nCode < 0) return UnsafeNativeMethods.CallNextHookEx(HookId, nCode, wParam, lParam);
- var hookStruct = (UnsafeNativeMethods.MOUSEHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(UnsafeNativeMethods.MOUSEHOOKSTRUCT));
+ if (nCode < 0) return InteropMethods.CallNextHookEx(HookId, nCode, wParam, lParam);
+ var hookStruct = (InteropValues.MOUSEHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(InteropValues.MOUSEHOOKSTRUCT));
StatusChanged?.Invoke(null, new MouseHookEventArgs
{
- Message = (MouseHookMessageType)wParam,
- Point = new NativeMethods.POINT(hookStruct.pt.X, hookStruct.pt.Y)
+ MessageType = (MouseHookMessageType)wParam,
+ Point = new InteropValues.POINT(hookStruct.pt.X, hookStruct.pt.Y)
});
- return UnsafeNativeMethods.CallNextHookEx(HookId, nCode, wParam, lParam);
+ return InteropMethods.CallNextHookEx(HookId, nCode, wParam, lParam);
}
}
}
diff --git a/src/Shared/HandyControl_Shared/Tools/Hook/SystemMenuHook.cs b/src/Shared/HandyControl_Shared/Tools/Hook/SystemMenuHook.cs
new file mode 100644
index 00000000..af10084f
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Hook/SystemMenuHook.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Interop;
+using HandyControl.Tools.Interop;
+
+namespace HandyControl.Tools
+{
+ public class SystemMenuHook
+ {
+ private static readonly Dictionary DataDic = new Dictionary();
+
+ public static event Action Click;
+
+ public static void Insert(int index, int id, string text, Window window)
+ {
+ var hookId = window.GetHandle();
+ var source = HwndSource.FromHwnd(hookId);
+ if (source != null)
+ {
+ DataDic[id] = source;
+ InteropMethods.InsertMenu(InteropMethods.GetSystemMenu(hookId, false), index, InteropValues.MF_BYPOSITION, id, text);
+ source.AddHook(WinProc);
+ }
+ }
+
+ public static void InsertSeperator(int index, Window window) => InteropMethods.InsertMenu(
+ InteropMethods.GetSystemMenu(window.GetHandle(), false), index,
+ InteropValues.MF_BYPOSITION | InteropValues.MF_SEPARATOR, 0, "");
+
+ public static void Remove(int id)
+ {
+ if (DataDic.TryGetValue(id, out var data))
+ {
+ data.RemoveHook(WinProc);
+ DataDic.Remove(id);
+ }
+ }
+
+ private static IntPtr WinProc(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
+ {
+ if (msg == InteropValues.WM_SYSCOMMAND)
+ {
+ var id = wparam.ToInt32();
+ if (DataDic.ContainsKey(id))
+ {
+ Click?.Invoke(id);
+ }
+ }
+ return IntPtr.Zero;
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/BITMAPINFO.cs b/src/Shared/HandyControl_Shared/Tools/Interop/BITMAPINFO.cs
deleted file mode 100644
index 4938fbdd..00000000
--- a/src/Shared/HandyControl_Shared/Tools/Interop/BITMAPINFO.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.InteropServices;
-using System.Security;
-
-namespace HandyControl.Tools.Interop
-{
- [StructLayout(LayoutKind.Sequential, Pack = 2)]
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- internal struct BITMAPINFO
- {
- public int bmiHeader_biSize;
-
- public int bmiHeader_biWidth;
-
- public int bmiHeader_biHeight;
-
- public short bmiHeader_biPlanes;
-
- public short bmiHeader_biBitCount;
-
- public int bmiHeader_biCompression;
-
- public int bmiHeader_biSizeImage;
-
- public int bmiHeader_biXPelsPerMeter;
-
- public int bmiHeader_biYPelsPerMeter;
-
- public int bmiHeader_biClrUsed;
-
- public int bmiHeader_biClrImportant;
-
- public BITMAPINFO(int width, int height, short bpp)
- {
- bmiHeader_biSize = SizeOf();
- bmiHeader_biWidth = width;
- bmiHeader_biHeight = height;
- bmiHeader_biPlanes = 1;
- bmiHeader_biBitCount = bpp;
- bmiHeader_biCompression = 0;
- bmiHeader_biSizeImage = 0;
- bmiHeader_biXPelsPerMeter = 0;
- bmiHeader_biYPelsPerMeter = 0;
- bmiHeader_biClrUsed = 0;
- bmiHeader_biClrImportant = 0;
- }
-
- [SecuritySafeCritical]
- private static int SizeOf()
- {
- return Marshal.SizeOf(typeof(BITMAPINFO));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/ExternDll.cs b/src/Shared/HandyControl_Shared/Tools/Interop/ExternDll.cs
deleted file mode 100644
index 81fa0c71..00000000
--- a/src/Shared/HandyControl_Shared/Tools/Interop/ExternDll.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace HandyControl.Tools.Interop
-{
- internal static class ExternDll
- {
- public const string
- User32 = "user32.dll",
- Gdi32 = "gdi32.dll",
- Kernel32 = "kernel32.dll",
- Shell32 = "shell32.dll";
- }
-}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/BitmapHandle.cs b/src/Shared/HandyControl_Shared/Tools/Interop/Handle/BitmapHandle.cs
similarity index 95%
rename from src/Shared/HandyControl_Shared/Tools/Interop/BitmapHandle.cs
rename to src/Shared/HandyControl_Shared/Tools/Interop/Handle/BitmapHandle.cs
index 1e893fa9..2fda6685 100644
--- a/src/Shared/HandyControl_Shared/Tools/Interop/BitmapHandle.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Interop/Handle/BitmapHandle.cs
@@ -24,7 +24,7 @@ namespace HandyControl.Tools.Interop
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
protected override bool ReleaseHandle()
{
- return UnsafeNativeMethods.DeleteObject(handle);
+ return InteropMethods.DeleteObject(handle);
}
[SecurityCritical]
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/CommonHandles.cs b/src/Shared/HandyControl_Shared/Tools/Interop/Handle/CommonHandles.cs
similarity index 100%
rename from src/Shared/HandyControl_Shared/Tools/Interop/CommonHandles.cs
rename to src/Shared/HandyControl_Shared/Tools/Interop/Handle/CommonHandles.cs
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/HandleCollector.cs b/src/Shared/HandyControl_Shared/Tools/Interop/Handle/HandleCollector.cs
similarity index 100%
rename from src/Shared/HandyControl_Shared/Tools/Interop/HandleCollector.cs
rename to src/Shared/HandyControl_Shared/Tools/Interop/Handle/HandleCollector.cs
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/IconHandle.cs b/src/Shared/HandyControl_Shared/Tools/Interop/Handle/IconHandle.cs
similarity index 92%
rename from src/Shared/HandyControl_Shared/Tools/Interop/IconHandle.cs
rename to src/Shared/HandyControl_Shared/Tools/Interop/Handle/IconHandle.cs
index cbaec541..96de9b10 100644
--- a/src/Shared/HandyControl_Shared/Tools/Interop/IconHandle.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Interop/Handle/IconHandle.cs
@@ -15,7 +15,7 @@ namespace HandyControl.Tools.Interop
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
protected override bool ReleaseHandle()
{
- return UnsafeNativeMethods.DestroyIcon(handle);
+ return InteropMethods.DestroyIcon(handle);
}
[SecurityCritical, SecuritySafeCritical]
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/SafeFileMappingHandle.cs b/src/Shared/HandyControl_Shared/Tools/Interop/Handle/SafeFileMappingHandle.cs
similarity index 95%
rename from src/Shared/HandyControl_Shared/Tools/Interop/SafeFileMappingHandle.cs
rename to src/Shared/HandyControl_Shared/Tools/Interop/Handle/SafeFileMappingHandle.cs
index ad26db90..c4aade37 100644
--- a/src/Shared/HandyControl_Shared/Tools/Interop/SafeFileMappingHandle.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Interop/Handle/SafeFileMappingHandle.cs
@@ -43,7 +43,7 @@ namespace HandyControl.Tools.Interop
public static bool CloseHandleNoThrow(HandleRef handle)
{
HandleCollector.Remove((IntPtr)handle, CommonHandles.Kernel);
- var result = UnsafeNativeMethods.IntCloseHandle(handle);
+ var result = InteropMethods.IntCloseHandle(handle);
return result;
}
}
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/WpfSafeHandle.cs b/src/Shared/HandyControl_Shared/Tools/Interop/Handle/WpfSafeHandle.cs
similarity index 100%
rename from src/Shared/HandyControl_Shared/Tools/Interop/WpfSafeHandle.cs
rename to src/Shared/HandyControl_Shared/Tools/Interop/Handle/WpfSafeHandle.cs
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/ICONINFO.cs b/src/Shared/HandyControl_Shared/Tools/Interop/ICONINFO.cs
deleted file mode 100644
index 659c98e6..00000000
--- a/src/Shared/HandyControl_Shared/Tools/Interop/ICONINFO.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.InteropServices;
-
-namespace HandyControl.Tools.Interop
-{
- [StructLayout(LayoutKind.Sequential)]
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- internal class ICONINFO
- {
- public bool fIcon = false;
- public int xHotspot = 0;
- public int yHotspot = 0;
- public BitmapHandle hbmMask = null;
- public BitmapHandle hbmColor = null;
- }
-}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/InteropMethods.cs b/src/Shared/HandyControl_Shared/Tools/Interop/InteropMethods.cs
new file mode 100644
index 00000000..0ec02507
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Interop/InteropMethods.cs
@@ -0,0 +1,450 @@
+using System;
+using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
+using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
+using System.Security;
+using System.Text;
+
+namespace HandyControl.Tools.Interop
+{
+ internal class InteropMethods
+ {
+ internal static readonly IntPtr HRGN_NONE = new IntPtr(-1);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto)]
+ [ResourceExposure(ResourceScope.None)]
+ internal static extern int RegisterWindowMessage(string msg);
+
+ [DllImport(InteropValues.ExternDll.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
+ internal static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, out InteropValues.TBBUTTON lpBuffer,
+ int dwSize, out int lpNumberOfBytesRead);
+
+ [DllImport(InteropValues.ExternDll.Kernel32, SetLastError = true)]
+ internal static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, out InteropValues.RECT lpBuffer,
+ int dwSize, out int lpNumberOfBytesRead);
+
+ [DllImport(InteropValues.ExternDll.Kernel32, SetLastError = true)]
+ internal static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, out InteropValues.TRAYDATA lpBuffer,
+ int dwSize, out int lpNumberOfBytesRead);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto)]
+ internal static extern uint SendMessage(IntPtr hWnd, uint Msg, uint wParam, IntPtr lParam);
+
+ [DllImport(InteropValues.ExternDll.User32, SetLastError = true, CharSet = CharSet.Auto)]
+ internal static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
+
+ [DllImport(InteropValues.ExternDll.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
+ internal static extern IntPtr OpenProcess(InteropValues.ProcessAccess dwDesiredAccess,
+ [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, uint dwProcessId);
+
+ [DllImport(InteropValues.ExternDll.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
+ internal static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, int dwSize,
+ InteropValues.AllocationType flAllocationType, InteropValues.MemoryProtection flProtect);
+
+ [DllImport(InteropValues.ExternDll.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
+ internal static extern int CloseHandle(IntPtr hObject);
+
+ [DllImport(InteropValues.ExternDll.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
+ internal static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, InteropValues.FreeType dwFreeType);
+
+ [DllImport(InteropValues.ExternDll.User32, SetLastError = true)]
+ internal static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
+
+ [DllImport(InteropValues.ExternDll.User32, SetLastError = true)]
+ internal static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass,
+ string lpszWindow);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ internal static extern int GetWindowRect(IntPtr hwnd, out InteropValues.RECT lpRect);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto)]
+ internal static extern bool GetCursorPos(out InteropValues.POINT pt);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ internal static extern IntPtr GetDesktopWindow();
+
+ [DllImport(InteropValues.ExternDll.User32, SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool AddClipboardFormatListener(IntPtr hwnd);
+
+ [DllImport(InteropValues.ExternDll.User32, SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool RemoveClipboardFormatListener(IntPtr hwnd);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ internal static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ internal static extern bool InsertMenu(IntPtr hMenu, int wPosition, int wFlags, int wIDNewItem, string lpNewItem);
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(InteropValues.ExternDll.User32, SetLastError = true, ExactSpelling = true, EntryPoint = nameof(GetDC),
+ CharSet = CharSet.Auto)]
+ internal static extern IntPtr IntGetDC(HandleRef hWnd);
+
+ [SecurityCritical]
+ internal static IntPtr GetDC(HandleRef hWnd)
+ {
+ var hDc = IntGetDC(hWnd);
+ if (hDc == IntPtr.Zero) throw new Win32Exception();
+
+ return HandleCollector.Add(hDc, CommonHandles.HDC);
+ }
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(InteropValues.ExternDll.User32, ExactSpelling = true, EntryPoint = nameof(ReleaseDC), CharSet = CharSet.Auto)]
+ internal static extern int IntReleaseDC(HandleRef hWnd, HandleRef hDC);
+
+ [SecurityCritical]
+ internal static int ReleaseDC(HandleRef hWnd, HandleRef hDC)
+ {
+ HandleCollector.Remove((IntPtr) hDC, CommonHandles.HDC);
+ return IntReleaseDC(hWnd, hDC);
+ }
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(InteropValues.ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)]
+ internal static extern int GetDeviceCaps(HandleRef hDC, int nIndex);
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(InteropValues.ExternDll.User32)]
+ internal static extern int GetSystemMetrics(InteropValues.SM nIndex);
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(InteropValues.ExternDll.User32, EntryPoint = nameof(DestroyIcon), CharSet = CharSet.Auto, SetLastError = true)]
+ private static extern bool IntDestroyIcon(IntPtr hIcon);
+
+ [SecurityCritical]
+ internal static bool DestroyIcon(IntPtr hIcon)
+ {
+ var result = IntDestroyIcon(hIcon);
+ return result;
+ }
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(InteropValues.ExternDll.Gdi32, EntryPoint = nameof(DeleteObject), CharSet = CharSet.Auto, SetLastError = true)]
+ private static extern bool IntDeleteObject(IntPtr hObject);
+
+ [SecurityCritical]
+ internal static bool DeleteObject(IntPtr hObject)
+ {
+ var result = IntDeleteObject(hObject);
+ return result;
+ }
+
+ [SecurityCritical]
+ internal static BitmapHandle CreateDIBSection(HandleRef hdc, ref InteropValues.BITMAPINFO bitmapInfo, int iUsage,
+ ref IntPtr ppvBits, SafeFileMappingHandle hSection, int dwOffset)
+ {
+ if (hSection == null) hSection = new SafeFileMappingHandle(IntPtr.Zero);
+
+ var hBitmap = PrivateCreateDIBSection(hdc, ref bitmapInfo, iUsage, ref ppvBits, hSection, dwOffset);
+ return hBitmap;
+ }
+
+ [DllImport(InteropValues.ExternDll.Kernel32, EntryPoint = "CloseHandle", CharSet = CharSet.Auto, SetLastError = true)]
+ internal static extern bool IntCloseHandle(HandleRef handle);
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(InteropValues.ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto,
+ EntryPoint = nameof(CreateDIBSection))]
+ private static extern BitmapHandle PrivateCreateDIBSection(HandleRef hdc, ref InteropValues.BITMAPINFO bitmapInfo, int iUsage,
+ ref IntPtr ppvBits, SafeFileMappingHandle hSection, int dwOffset);
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(InteropValues.ExternDll.User32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto,
+ EntryPoint = nameof(CreateIconIndirect))]
+ private static extern IconHandle PrivateCreateIconIndirect([In] [MarshalAs(UnmanagedType.LPStruct)]
+ InteropValues.ICONINFO iconInfo);
+
+ [SecurityCritical]
+ internal static IconHandle CreateIconIndirect([In] [MarshalAs(UnmanagedType.LPStruct)]
+ InteropValues.ICONINFO iconInfo)
+ {
+ var hIcon = PrivateCreateIconIndirect(iconInfo);
+ return hIcon;
+ }
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(InteropValues.ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto,
+ EntryPoint = nameof(CreateBitmap))]
+ private static extern BitmapHandle PrivateCreateBitmap(int width, int height, int planes, int bitsPerPixel,
+ byte[] lpvBits);
+
+ [SecurityCritical]
+ internal static BitmapHandle CreateBitmap(int width, int height, int planes, int bitsPerPixel, byte[] lpvBits)
+ {
+ var hBitmap = PrivateCreateBitmap(width, height, planes, bitsPerPixel, lpvBits);
+ return hBitmap;
+ }
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(InteropValues.ExternDll.Kernel32, EntryPoint = "GetModuleFileName", CharSet = CharSet.Unicode,
+ SetLastError = true)]
+ private static extern int IntGetModuleFileName(HandleRef hModule, StringBuilder buffer, int length);
+
+ [SecurityCritical]
+ internal static string GetModuleFileName(HandleRef hModule)
+ {
+ var buffer = new StringBuilder(InteropValues.Win32Constant.MAX_PATH);
+ while (true)
+ {
+ var size = IntGetModuleFileName(hModule, buffer, buffer.Capacity);
+ if (size == 0) throw new Win32Exception();
+
+ if (size == buffer.Capacity)
+ {
+ buffer.EnsureCapacity(buffer.Capacity * 2);
+ continue;
+ }
+
+ return buffer.ToString();
+ }
+ }
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(InteropValues.ExternDll.Shell32, CharSet = CharSet.Auto, BestFitMapping = false, ThrowOnUnmappableChar = true)]
+ internal static extern int ExtractIconEx(string szExeFileName, int nIconIndex, out IconHandle phiconLarge,
+ out IconHandle phiconSmall, int nIcons);
+
+ [DllImport(InteropValues.ExternDll.Shell32, CharSet = CharSet.Auto)]
+ internal static extern int Shell_NotifyIcon(int message, InteropValues.NOTIFYICONDATA pnid);
+
+ [SecurityCritical]
+ [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ [DllImport(InteropValues.ExternDll.User32, SetLastError = true, CharSet = CharSet.Unicode, EntryPoint = "CreateWindowExW")]
+ internal static extern IntPtr CreateWindowEx(
+ int dwExStyle,
+ [MarshalAs(UnmanagedType.LPWStr)] string lpClassName,
+ [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName,
+ int dwStyle,
+ int x,
+ int y,
+ int nWidth,
+ int nHeight,
+ IntPtr hWndParent,
+ IntPtr hMenu,
+ IntPtr hInstance,
+ IntPtr lpParam);
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
+ internal static extern short RegisterClass(InteropValues.WNDCLASS4ICON wc);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto)]
+ internal static extern IntPtr DefWindowProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport(InteropValues.ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)]
+ internal static extern bool SetForegroundWindow(IntPtr hWnd);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto, SetLastError = true)]
+ internal static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam);
+
+ [DllImport(InteropValues.ExternDll.Kernel32, CharSet = CharSet.Auto, SetLastError = true)]
+ internal static extern IntPtr GetModuleHandle(string lpModuleName);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto, SetLastError = true)]
+ internal static extern bool UnhookWindowsHookEx(IntPtr hhk);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto, SetLastError = true)]
+ internal static extern IntPtr SetWindowsHookEx(int idHook, InteropValues.HookProc lpfn, IntPtr hMod, uint dwThreadId);
+
+ [DllImport(InteropValues.ExternDll.User32, SetLastError = true)]
+ internal static extern IntPtr GetWindowDC(IntPtr window);
+
+ [DllImport(InteropValues.ExternDll.Gdi32, SetLastError = true)]
+ internal static extern uint GetPixel(IntPtr dc, int x, int y);
+
+ [DllImport(InteropValues.ExternDll.User32, SetLastError = true)]
+ internal static extern int ReleaseDC(IntPtr window, IntPtr dc);
+
+ [DllImport(InteropValues.ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)]
+ internal static extern int GetDeviceCaps(IntPtr hdc, int nIndex);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto)]
+ internal static extern IntPtr GetDC(IntPtr ptr);
+
+ [DllImport(InteropValues.ExternDll.User32, SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ private static extern bool GetWindowPlacement(IntPtr hwnd, InteropValues.WINDOWPLACEMENT lpwndpl);
+
+ internal static InteropValues.WINDOWPLACEMENT GetWindowPlacement(IntPtr hwnd)
+ {
+ InteropValues.WINDOWPLACEMENT wINDOWPLACEMENT = new InteropValues.WINDOWPLACEMENT();
+ if (GetWindowPlacement(hwnd, wINDOWPLACEMENT))
+ {
+ return wINDOWPLACEMENT;
+ }
+ throw new Win32Exception(Marshal.GetLastWin32Error());
+ }
+
+ internal static int GetXLParam(int lParam) => LoWord(lParam);
+
+ internal static int GetYLParam(int lParam) => HiWord(lParam);
+
+ internal static int HiWord(int value) => (short)(value >> 16);
+
+ internal static int LoWord(int value) => (short)(value & 65535);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool EnumThreadWindows(uint dwThreadId, InteropValues.EnumWindowsProc lpfn, IntPtr lParam);
+
+ [DllImport(InteropValues.ExternDll.Gdi32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool DeleteDC(IntPtr hdc);
+
+ [DllImport(InteropValues.ExternDll.Gdi32, SetLastError = true)]
+ internal static extern IntPtr CreateCompatibleDC(IntPtr hdc);
+
+ [DllImport(InteropValues.ExternDll.Gdi32, ExactSpelling = true, SetLastError = true)]
+ internal static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern IntPtr SendMessage(IntPtr hWnd, int nMsg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ internal static extern IntPtr MonitorFromPoint(InteropValues.POINT pt, int flags);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ internal static extern IntPtr GetWindow(IntPtr hwnd, int nCmd);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool IsWindowVisible(IntPtr hwnd);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool IsIconic(IntPtr hwnd);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool IsZoomed(IntPtr hwnd);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto, ExactSpelling = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, int flags);
+
+ internal static System.Windows.Point GetCursorPos()
+ {
+ var result = default(System.Windows.Point);
+ if (GetCursorPos(out var point))
+ {
+ result.X = point.X;
+ result.Y = point.Y;
+ }
+ return result;
+ }
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
+
+ internal static int GetWindowLong(IntPtr hWnd, InteropValues.GWL nIndex) => GetWindowLong(hWnd, (int)nIndex);
+
+ internal static IntPtr SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong)
+ {
+ if (IntPtr.Size == 4)
+ {
+ return SetWindowLongPtr32(hWnd, nIndex, dwNewLong);
+ }
+ return SetWindowLongPtr64(hWnd, nIndex, dwNewLong);
+ }
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "SetWindowLong")]
+ internal static extern IntPtr SetWindowLongPtr32(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "SetWindowLongPtr")]
+ internal static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Unicode)]
+ private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Unicode)]
+ private static extern IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
+
+ internal static IntPtr SetWindowLongPtr(IntPtr hWnd, InteropValues.GWLP nIndex, IntPtr dwNewLong)
+ {
+ if (IntPtr.Size == 8)
+ {
+ return SetWindowLongPtr(hWnd, (int)nIndex, dwNewLong);
+ }
+ return new IntPtr(SetWindowLong(hWnd, (int)nIndex, dwNewLong.ToInt32()));
+ }
+
+ internal static int SetWindowLong(IntPtr hWnd, InteropValues.GWL nIndex, int dwNewLong) => SetWindowLong(hWnd, (int)nIndex, dwNewLong);
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Unicode)]
+ internal static extern ushort RegisterClass(ref InteropValues.WNDCLASS lpWndClass);
+
+ [DllImport(InteropValues.ExternDll.Kernel32)]
+ internal static extern uint GetCurrentThreadId();
+
+ [DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern IntPtr CreateWindowEx(int dwExStyle, IntPtr classAtom, string lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool DestroyWindow(IntPtr hwnd);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool UnregisterClass(IntPtr classAtom, IntPtr hInstance);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDest, ref InteropValues.POINT pptDest, ref InteropValues.SIZE psize, IntPtr hdcSrc, ref InteropValues.POINT pptSrc, uint crKey, [In] ref InteropValues.BLENDFUNCTION pblend, uint dwFlags);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ internal static extern bool RedrawWindow(IntPtr hWnd, IntPtr lprcUpdate, IntPtr hrgnUpdate, InteropValues.RedrawWindowFlags flags);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, InteropValues.EnumMonitorsDelegate lpfnEnum, IntPtr dwData);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool IntersectRect(out InteropValues.RECT lprcDst, [In] ref InteropValues.RECT lprcSrc1, [In] ref InteropValues.RECT lprcSrc2);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool GetMonitorInfo(IntPtr hMonitor, ref InteropValues.MONITORINFO monitorInfo);
+
+ [DllImport(InteropValues.ExternDll.Gdi32, SetLastError = true)]
+ internal static extern IntPtr CreateDIBSection(IntPtr hdc, ref InteropValues.BITMAPINFO pbmi, uint iUsage, out IntPtr ppvBits, IntPtr hSection, uint dwOffset);
+
+ [DllImport(InteropValues.ExternDll.MsImg)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool AlphaBlend(IntPtr hdcDest, int xoriginDest, int yoriginDest, int wDest, int hDest, IntPtr hdcSrc, int xoriginSrc, int yoriginSrc, int wSrc, int hSrc, InteropValues.BLENDFUNCTION pfn);
+
+ internal static int GET_SC_WPARAM(IntPtr wParam) => (int)wParam & 65520;
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ internal static extern IntPtr ChildWindowFromPointEx(IntPtr hwndParent, InteropValues.POINT pt, int uFlags);
+
+ [DllImport(InteropValues.ExternDll.Gdi32)]
+ internal static extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int width, int height);
+
+ [DllImport(InteropValues.ExternDll.Gdi32)]
+ internal static extern bool BitBlt(IntPtr hDC, int x, int y, int nWidth, int nHeight, IntPtr hSrcDC, int xSrc, int ySrc, int dwRop);
+
+ [DllImport(InteropValues.ExternDll.User32)]
+ [ResourceExposure(ResourceScope.None)]
+ internal static extern bool EnableWindow(IntPtr hWnd, bool enable);
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/InteropValues.cs b/src/Shared/HandyControl_Shared/Tools/Interop/InteropValues.cs
new file mode 100644
index 00000000..9a08d865
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/Interop/InteropValues.cs
@@ -0,0 +1,663 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Security;
+using System.Windows;
+
+namespace HandyControl.Tools.Interop
+{
+ internal class InteropValues
+ {
+ internal static class ExternDll
+ {
+ public const string
+ User32 = "user32.dll",
+ Gdi32 = "gdi32.dll",
+ Kernel32 = "kernel32.dll",
+ Shell32 = "shell32.dll",
+ MsImg = "msimg32.dll";
+ }
+
+ internal delegate IntPtr HookProc(int code, IntPtr wParam, IntPtr lParam);
+
+ internal delegate IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
+
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal delegate bool EnumMonitorsDelegate(IntPtr hMonitor, IntPtr hdcMonitor, ref RECT lprcMonitor, IntPtr dwData);
+
+ internal delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
+
+ internal const int
+ BITSPIXEL = 12,
+ PLANES = 14,
+ BI_RGB = 0,
+ DIB_RGB_COLORS = 0,
+ NIF_MESSAGE = 0x00000001,
+ NIF_ICON = 0x00000002,
+ NIF_TIP = 0x00000004,
+ NIF_INFO = 0x00000010,
+ NIM_ADD = 0x00000000,
+ NIM_MODIFY = 0x00000001,
+ NIM_DELETE = 0x00000002,
+ NIIF_NONE = 0x00000000,
+ NIIF_INFO = 0x00000001,
+ NIIF_WARNING = 0x00000002,
+ NIIF_ERROR = 0x00000003,
+ WM_ACTIVATE = 0x0006,
+ WM_QUIT = 0x0012,
+ WM_WINDOWPOSCHANGING = 0x0046,
+ WM_WINDOWPOSCHANGED = 0x0047,
+ WM_SETICON = 0x0080,
+ WM_NCCREATE = 0x0081,
+ WM_NCDESTROY = 0x0082,
+ WM_NCACTIVATE = 0x0086,
+ WM_NCRBUTTONDOWN = 0x00A4,
+ WM_NCRBUTTONUP = 0x00A5,
+ WM_NCRBUTTONDBLCLK = 0x00A6,
+ WM_NCUAHDRAWCAPTION = 0x00AE,
+ WM_NCUAHDRAWFRAME = 0x00AF,
+ WM_KEYDOWN = 0x0100,
+ WM_KEYUP = 0x0101,
+ WM_SYSKEYDOWN = 0x0104,
+ WM_SYSKEYUP = 0x0105,
+ WM_SYSCOMMAND = 0x112,
+ WM_MOUSEMOVE = 0x0200,
+ WM_LBUTTONUP = 0x0202,
+ WM_LBUTTONDBLCLK = 0x0203,
+ WM_RBUTTONUP = 0x0205,
+ WM_CLIPBOARDUPDATE = 0x031D,
+ WM_USER = 0x0400,
+ WS_VISIBLE = 0x10000000,
+ MF_BYPOSITION = 0x400,
+ MF_SEPARATOR = 0x800,
+ TB_GETBUTTON = WM_USER + 23,
+ TB_BUTTONCOUNT = WM_USER + 24,
+ TB_GETITEMRECT = WM_USER + 29,
+ VERTRES = 10,
+ DESKTOPVERTRES = 117,
+ LOGPIXELSX = 88,
+ LOGPIXELSY = 90,
+ SC_SIZE = 0xF000,
+ SC_MOVE = 0xF010,
+ SC_MINIMIZE = 0xF020,
+ SC_MAXIMIZE = 0xF030,
+ SC_RESTORE = 0xF120,
+ SRCCOPY = 0x00CC0020;
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ internal class NOTIFYICONDATA
+ {
+ public int cbSize = Marshal.SizeOf(typeof(NOTIFYICONDATA));
+ public IntPtr hWnd;
+ public int uID;
+ public int uFlags;
+ public int uCallbackMessage;
+ public IntPtr hIcon;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
+ public string szTip = string.Empty;
+ public int dwState = 0x01;
+ public int dwStateMask = 0x01;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
+ public string szInfo = string.Empty;
+ public int uTimeoutOrVersion;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
+ public string szInfoTitle = string.Empty;
+ public int dwInfoFlags;
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
+ internal struct TBBUTTON
+ {
+ public int iBitmap;
+ public int idCommand;
+ public IntPtr fsStateStylePadding;
+ public IntPtr dwData;
+ public IntPtr iString;
+ }
+
+ [Flags]
+ internal enum AllocationType
+ {
+ Commit = 0x1000,
+ Reserve = 0x2000,
+ Decommit = 0x4000,
+ Release = 0x8000,
+ Reset = 0x80000,
+ Physical = 0x400000,
+ TopDown = 0x100000,
+ WriteWatch = 0x200000,
+ LargePages = 0x20000000
+ }
+
+ [Flags]
+ internal enum MemoryProtection
+ {
+ Execute = 0x10,
+ ExecuteRead = 0x20,
+ ExecuteReadWrite = 0x40,
+ ExecuteWriteCopy = 0x80,
+ NoAccess = 0x01,
+ ReadOnly = 0x02,
+ ReadWrite = 0x04,
+ WriteCopy = 0x08,
+ GuardModifierflag = 0x100,
+ NoCacheModifierflag = 0x200,
+ WriteCombineModifierflag = 0x400
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct TRAYDATA
+ {
+ public IntPtr hwnd;
+ public uint uID;
+ public uint uCallbackMessage;
+ public uint bReserved0;
+ public uint bReserved1;
+ public IntPtr hIcon;
+ }
+
+ [Flags]
+ internal enum FreeType
+ {
+ Decommit = 0x4000,
+ Release = 0x8000,
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct POINT
+ {
+ public int X;
+ public int Y;
+
+ public POINT(int x, int y)
+ {
+ X = x;
+ Y = y;
+ }
+ }
+
+ internal enum HookType
+ {
+ WH_KEYBOARD_LL = 13,
+ WH_MOUSE_LL = 14
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct MOUSEHOOKSTRUCT
+ {
+ public POINT pt;
+ public IntPtr hwnd;
+ public uint wHitTestCode;
+ public IntPtr dwExtraInfo;
+ }
+
+ [Flags]
+ internal enum ProcessAccess
+ {
+ AllAccess = CreateThread | DuplicateHandle | QueryInformation | SetInformation | Terminate | VMOperation | VMRead | VMWrite | Synchronize,
+ CreateThread = 0x2,
+ DuplicateHandle = 0x40,
+ QueryInformation = 0x400,
+ SetInformation = 0x200,
+ Terminate = 0x1,
+ VMOperation = 0x8,
+ VMRead = 0x10,
+ VMWrite = 0x20,
+ Synchronize = 0x100000
+ }
+
+ [Serializable, StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ internal struct RECT
+ {
+ public int Left;
+ public int Top;
+ public int Right;
+ public int Bottom;
+
+ public RECT(int left, int top, int right, int bottom)
+ {
+ Left = left;
+ Top = top;
+ Right = right;
+ Bottom = bottom;
+ }
+
+ public RECT(Rect rect)
+ {
+ Left = (int)rect.Left;
+ Top = (int)rect.Top;
+ Right = (int)rect.Right;
+ Bottom = (int)rect.Bottom;
+ }
+
+ public Point Position => new Point(Left, Top);
+ public Size Size => new Size(Width, Height);
+
+ public int Height
+ {
+ get => Bottom - Top;
+ set => Bottom = Top + value;
+ }
+
+ public int Width
+ {
+ get => Right - Left;
+ set => Right = Left + value;
+ }
+ }
+
+ internal struct BLENDFUNCTION
+ {
+ public byte BlendOp;
+ public byte BlendFlags;
+ public byte SourceConstantAlpha;
+ public byte AlphaFormat;
+ }
+
+ internal enum GWL
+ {
+ STYLE = -16,
+ EXSTYLE = -20
+ }
+
+ internal enum GWLP
+ {
+ WNDPROC = -4,
+ HINSTANCE = -6,
+ HWNDPARENT = -8,
+ USERDATA = -21,
+ ID = -12
+ }
+
+ internal struct BITMAPINFOHEADER
+ {
+ internal uint biSize;
+ internal int biWidth;
+ internal int biHeight;
+ internal ushort biPlanes;
+ internal ushort biBitCount;
+ internal uint biCompression;
+ internal uint biSizeImage;
+ internal int biXPelsPerMeter;
+ internal int biYPelsPerMeter;
+ internal uint biClrUsed;
+ internal uint biClrImportant;
+ }
+
+ [Flags]
+ internal enum RedrawWindowFlags : uint
+ {
+ Invalidate = 1u,
+ InternalPaint = 2u,
+ Erase = 4u,
+ Validate = 8u,
+ NoInternalPaint = 16u,
+ NoErase = 32u,
+ NoChildren = 64u,
+ AllChildren = 128u,
+ UpdateNow = 256u,
+ EraseNow = 512u,
+ Frame = 1024u,
+ NoFrame = 2048u
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class WINDOWPOS
+ {
+ public IntPtr hwnd;
+ public IntPtr hwndInsertAfter;
+ public int x;
+ public int y;
+ public int cx;
+ public int cy;
+ public uint flags;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class WINDOWPLACEMENT
+ {
+ public int length = Marshal.SizeOf(typeof(WINDOWPLACEMENT));
+ public int flags;
+ public int showCmd;
+ public POINT ptMinPosition;
+ public POINT ptMaxPosition;
+ public RECT rcNormalPosition;
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 4)]
+ internal struct SIZE
+ {
+ [ComAliasName("Microsoft.VisualStudio.OLE.Interop.LONG")]
+ public int cx;
+ [ComAliasName("Microsoft.VisualStudio.OLE.Interop.LONG")]
+ public int cy;
+ }
+
+ internal struct MONITORINFO
+ {
+ public uint cbSize;
+ public RECT rcMonitor;
+ public RECT rcWork;
+ public uint dwFlags;
+ }
+
+ internal enum SM
+ {
+ CXSCREEN = 0,
+ CYSCREEN = 1,
+ CXVSCROLL = 2,
+ CYHSCROLL = 3,
+ CYCAPTION = 4,
+ CXBORDER = 5,
+ CYBORDER = 6,
+ CXFIXEDFRAME = 7,
+ CYFIXEDFRAME = 8,
+ CYVTHUMB = 9,
+ CXHTHUMB = 10,
+ CXICON = 11,
+ CYICON = 12,
+ CXCURSOR = 13,
+ CYCURSOR = 14,
+ CYMENU = 15,
+ CXFULLSCREEN = 16,
+ CYFULLSCREEN = 17,
+ CYKANJIWINDOW = 18,
+ MOUSEPRESENT = 19,
+ CYVSCROLL = 20,
+ CXHSCROLL = 21,
+ DEBUG = 22,
+ SWAPBUTTON = 23,
+ CXMIN = 28,
+ CYMIN = 29,
+ CXSIZE = 30,
+ CYSIZE = 31,
+ CXFRAME = 32,
+ CXSIZEFRAME = CXFRAME,
+ CYFRAME = 33,
+ CYSIZEFRAME = CYFRAME,
+ CXMINTRACK = 34,
+ CYMINTRACK = 35,
+ CXDOUBLECLK = 36,
+ CYDOUBLECLK = 37,
+ CXICONSPACING = 38,
+ CYICONSPACING = 39,
+ MENUDROPALIGNMENT = 40,
+ PENWINDOWS = 41,
+ DBCSENABLED = 42,
+ CMOUSEBUTTONS = 43,
+ SECURE = 44,
+ CXEDGE = 45,
+ CYEDGE = 46,
+ CXMINSPACING = 47,
+ CYMINSPACING = 48,
+ CXSMICON = 49,
+ CYSMICON = 50,
+ CYSMCAPTION = 51,
+ CXSMSIZE = 52,
+ CYSMSIZE = 53,
+ CXMENUSIZE = 54,
+ CYMENUSIZE = 55,
+ ARRANGE = 56,
+ CXMINIMIZED = 57,
+ CYMINIMIZED = 58,
+ CXMAXTRACK = 59,
+ CYMAXTRACK = 60,
+ CXMAXIMIZED = 61,
+ CYMAXIMIZED = 62,
+ NETWORK = 63,
+ CLEANBOOT = 67,
+ CXDRAG = 68,
+ CYDRAG = 69,
+ SHOWSOUNDS = 70,
+ CXMENUCHECK = 71,
+ CYMENUCHECK = 72,
+ SLOWMACHINE = 73,
+ MIDEASTENABLED = 74,
+ MOUSEWHEELPRESENT = 75,
+ XVIRTUALSCREEN = 76,
+ YVIRTUALSCREEN = 77,
+ CXVIRTUALSCREEN = 78,
+ CYVIRTUALSCREEN = 79,
+ CMONITORS = 80,
+ SAMEDISPLAYFORMAT = 81,
+ IMMENABLED = 82,
+ CXFOCUSBORDER = 83,
+ CYFOCUSBORDER = 84,
+ TABLETPC = 86,
+ MEDIACENTER = 87,
+ REMOTESESSION = 0x1000,
+ REMOTECONTROL = 0x2001
+ }
+
+ internal enum CacheSlot
+ {
+ DpiX,
+
+ FocusBorderWidth,
+ FocusBorderHeight,
+ HighContrast,
+ MouseVanish,
+
+ DropShadow,
+ FlatMenu,
+ WorkAreaInternal,
+ WorkArea,
+
+ IconMetrics,
+
+ KeyboardCues,
+ KeyboardDelay,
+ KeyboardPreference,
+ KeyboardSpeed,
+ SnapToDefaultButton,
+ WheelScrollLines,
+ MouseHoverTime,
+ MouseHoverHeight,
+ MouseHoverWidth,
+
+ MenuDropAlignment,
+ MenuFade,
+ MenuShowDelay,
+
+ ComboBoxAnimation,
+ ClientAreaAnimation,
+ CursorShadow,
+ GradientCaptions,
+ HotTracking,
+ ListBoxSmoothScrolling,
+ MenuAnimation,
+ SelectionFade,
+ StylusHotTracking,
+ ToolTipAnimation,
+ ToolTipFade,
+ UIEffects,
+
+ MinimizeAnimation,
+ Border,
+ CaretWidth,
+ ForegroundFlashCount,
+ DragFullWindows,
+ NonClientMetrics,
+
+ ThinHorizontalBorderHeight,
+ ThinVerticalBorderWidth,
+ CursorWidth,
+ CursorHeight,
+ ThickHorizontalBorderHeight,
+ ThickVerticalBorderWidth,
+ MinimumHorizontalDragDistance,
+ MinimumVerticalDragDistance,
+ FixedFrameHorizontalBorderHeight,
+ FixedFrameVerticalBorderWidth,
+ FocusHorizontalBorderHeight,
+ FocusVerticalBorderWidth,
+ FullPrimaryScreenWidth,
+ FullPrimaryScreenHeight,
+ HorizontalScrollBarButtonWidth,
+ HorizontalScrollBarHeight,
+ HorizontalScrollBarThumbWidth,
+ IconWidth,
+ IconHeight,
+ IconGridWidth,
+ IconGridHeight,
+ MaximizedPrimaryScreenWidth,
+ MaximizedPrimaryScreenHeight,
+ MaximumWindowTrackWidth,
+ MaximumWindowTrackHeight,
+ MenuCheckmarkWidth,
+ MenuCheckmarkHeight,
+ MenuButtonWidth,
+ MenuButtonHeight,
+ MinimumWindowWidth,
+ MinimumWindowHeight,
+ MinimizedWindowWidth,
+ MinimizedWindowHeight,
+ MinimizedGridWidth,
+ MinimizedGridHeight,
+ MinimumWindowTrackWidth,
+ MinimumWindowTrackHeight,
+ PrimaryScreenWidth,
+ PrimaryScreenHeight,
+ WindowCaptionButtonWidth,
+ WindowCaptionButtonHeight,
+ ResizeFrameHorizontalBorderHeight,
+ ResizeFrameVerticalBorderWidth,
+ SmallIconWidth,
+ SmallIconHeight,
+ SmallWindowCaptionButtonWidth,
+ SmallWindowCaptionButtonHeight,
+ VirtualScreenWidth,
+ VirtualScreenHeight,
+ VerticalScrollBarWidth,
+ VerticalScrollBarButtonHeight,
+ WindowCaptionHeight,
+ KanjiWindowHeight,
+ MenuBarHeight,
+ VerticalScrollBarThumbHeight,
+ IsImmEnabled,
+ IsMediaCenter,
+ IsMenuDropRightAligned,
+ IsMiddleEastEnabled,
+ IsMousePresent,
+ IsMouseWheelPresent,
+ IsPenWindows,
+ IsRemotelyControlled,
+ IsRemoteSession,
+ ShowSounds,
+ IsSlowMachine,
+ SwapButtons,
+ IsTabletPC,
+ VirtualScreenLeft,
+ VirtualScreenTop,
+
+ PowerLineStatus,
+
+ IsGlassEnabled,
+ UxThemeName,
+ UxThemeColor,
+ WindowCornerRadius,
+ WindowGlassColor,
+ WindowGlassBrush,
+ WindowNonClientFrameThickness,
+ WindowResizeBorderThickness,
+
+ NumSlots
+ }
+
+ internal static class Win32Constant
+ {
+ internal const int MAX_PATH = 260;
+ internal const int INFOTIPSIZE = 1024;
+ internal const int TRUE = 1;
+ internal const int FALSE = 0;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ internal struct WNDCLASS
+ {
+ public uint style;
+ public Delegate lpfnWndProc;
+ public int cbClsExtra;
+ public int cbWndExtra;
+ public IntPtr hInstance;
+ public IntPtr hIcon;
+ public IntPtr hCursor;
+ public IntPtr hbrBackground;
+ [MarshalAs(UnmanagedType.LPWStr)]
+ public string lpszMenuName;
+ [MarshalAs(UnmanagedType.LPWStr)]
+ public string lpszClassName;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ internal class WNDCLASS4ICON
+ {
+ public int style;
+ public WndProc lpfnWndProc;
+ public int cbClsExtra;
+ public int cbWndExtra;
+ public IntPtr hInstance;
+ public IntPtr hIcon;
+ public IntPtr hCursor;
+ public IntPtr hbrBackground;
+ public string lpszMenuName;
+ public string lpszClassName;
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 2)]
+ internal struct BITMAPINFO
+ {
+ public int biSize;
+
+ public int biWidth;
+
+ public int biHeight;
+
+ public short biPlanes;
+
+ public short biBitCount;
+
+ public int biCompression;
+
+ public int biSizeImage;
+
+ public int biXPelsPerMeter;
+
+ public int biYPelsPerMeter;
+
+ public int biClrUsed;
+
+ public int biClrImportant;
+
+ public BITMAPINFO(int width, int height, short bpp)
+ {
+ biSize = SizeOf();
+ biWidth = width;
+ biHeight = height;
+ biPlanes = 1;
+ biBitCount = bpp;
+ biCompression = 0;
+ biSizeImage = 0;
+ biXPelsPerMeter = 0;
+ biYPelsPerMeter = 0;
+ biClrUsed = 0;
+ biClrImportant = 0;
+ }
+
+ [SecuritySafeCritical]
+ private static int SizeOf()
+ {
+ return Marshal.SizeOf(typeof(BITMAPINFO));
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class ICONINFO
+ {
+ public bool fIcon = false;
+ public int xHotspot = 0;
+ public int yHotspot = 0;
+ public BitmapHandle hbmMask = null;
+ public BitmapHandle hbmColor = null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/NOTIFYICONDATA.cs b/src/Shared/HandyControl_Shared/Tools/Interop/NOTIFYICONDATA.cs
deleted file mode 100644
index c57d604a..00000000
--- a/src/Shared/HandyControl_Shared/Tools/Interop/NOTIFYICONDATA.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.InteropServices;
-
-namespace HandyControl.Tools.Interop
-{
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- public class NOTIFYICONDATA
- {
- public int cbSize = Marshal.SizeOf(typeof(NOTIFYICONDATA));
- public IntPtr hWnd;
- public int uID;
- public int uFlags;
- public int uCallbackMessage;
- public IntPtr hIcon;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
- public string szTip = string.Empty;
- public int dwState = 0x01;
- public int dwStateMask = 0x01;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
- public string szInfo = string.Empty;
- public int uTimeoutOrVersion;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
- public string szInfoTitle = string.Empty;
- public int dwInfoFlags;
- }
-}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/NativeMethods.cs b/src/Shared/HandyControl_Shared/Tools/Interop/NativeMethods.cs
deleted file mode 100644
index e41d4e26..00000000
--- a/src/Shared/HandyControl_Shared/Tools/Interop/NativeMethods.cs
+++ /dev/null
@@ -1,223 +0,0 @@
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
-using System.Security;
-
-namespace HandyControl.Tools.Interop
-{
- public delegate IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
-
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- [SuppressMessage("ReSharper", "IdentifierTypo")]
- internal class NativeMethods
- {
- public const int
- WS_CHILD = 0x40000000,
- BITSPIXEL = 12,
- PLANES = 14,
- BI_RGB = 0,
- DIB_RGB_COLORS = 0,
- NIF_MESSAGE = 0x00000001,
- NIF_ICON = 0x00000002,
- NIF_TIP = 0x00000004,
- NIF_INFO = 0x00000010,
- NIN_BALLOONSHOW = WM_USER + 2,
- NIN_BALLOONHIDE = WM_USER + 3,
- NIN_BALLOONTIMEOUT = WM_USER + 4,
- NIM_ADD = 0x00000000,
- NIM_MODIFY = 0x00000001,
- NIM_DELETE = 0x00000002,
- NIIF_NONE = 0x00000000,
- NIIF_INFO = 0x00000001,
- NIIF_WARNING = 0x00000002,
- NIIF_ERROR = 0x00000003,
- WM_KEYDOWN = 0x0100,
- WM_KEYUP = 0x0101,
- WM_SYSKEYDOWN = 0x0104,
- WM_SYSKEYUP = 0x0105,
- WM_MOUSEMOVE = 0x0200,
- WM_LBUTTONDOWN = 0x0201,
- WM_LBUTTONUP = 0x0202,
- WM_LBUTTONDBLCLK = 0x0203,
- WM_RBUTTONDOWN = 0x0204,
- WM_RBUTTONUP = 0x0205,
- WM_RBUTTONDBLCLK = 0x0206,
- WM_MBUTTONDOWN = 0x0207,
- WM_MBUTTONUP = 0x0208,
- WM_MBUTTONDBLCLK = 0x0209,
- WM_USER = 0x0400,
- TB_GETBUTTON = WM_USER + 23,
- TB_BUTTONCOUNT = WM_USER + 24,
- TB_GETITEMRECT = WM_USER + 29,
- STANDARD_RIGHTS_REQUIRED = 0x000F0000,
- SYNCHRONIZE = 0x00100000,
- PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF,
- MEM_COMMIT = 0x1000,
- MEM_RELEASE = 0x8000,
- PAGE_READWRITE = 0x04,
- TBSTATE_HIDDEN = 0x08,
- VERTRES = 10,
- HORZRES = 8,
- DESKTOPVERTRES = 117,
- DESKTOPHORZRES = 118,
- LOGPIXELSX = 88,
- LOGPIXELSY = 90,
- CXFRAME = 32,
- CXSIZEFRAME = CXFRAME;
-
- [Flags]
- public enum ProcessAccess
- {
- AllAccess = CreateThread | DuplicateHandle | QueryInformation | SetInformation | Terminate | VMOperation | VMRead | VMWrite | Synchronize,
- CreateThread = 0x2,
- DuplicateHandle = 0x40,
- QueryInformation = 0x400,
- SetInformation = 0x200,
- Terminate = 0x1,
- VMOperation = 0x8,
- VMRead = 0x10,
- VMWrite = 0x20,
- Synchronize = 0x100000
- }
-
- [Serializable, StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
- public struct RECT
- {
- public int Left;
- public int Top;
- public int Right;
- public int Bottom;
-
- public RECT(int left, int top, int right, int bottom)
- {
- Left = left;
- Top = top;
- Right = right;
- Bottom = bottom;
- }
- }
-
- [StructLayout(LayoutKind.Sequential, Pack = 1)]
- public struct TBBUTTON
- {
- public int iBitmap;
- public int idCommand;
- public IntPtr fsStateStylePadding;
- public IntPtr dwData;
- public IntPtr iString;
- }
-
- [Flags]
- public enum AllocationType
- {
- Commit = 0x1000,
- Reserve = 0x2000,
- Decommit = 0x4000,
- Release = 0x8000,
- Reset = 0x80000,
- Physical = 0x400000,
- TopDown = 0x100000,
- WriteWatch = 0x200000,
- LargePages = 0x20000000
- }
-
- [Flags]
- public enum MemoryProtection
- {
- Execute = 0x10,
- ExecuteRead = 0x20,
- ExecuteReadWrite = 0x40,
- ExecuteWriteCopy = 0x80,
- NoAccess = 0x01,
- ReadOnly = 0x02,
- ReadWrite = 0x04,
- WriteCopy = 0x08,
- GuardModifierflag = 0x100,
- NoCacheModifierflag = 0x200,
- WriteCombineModifierflag = 0x400
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct TRAYDATA
- {
- public IntPtr hwnd;
- public uint uID;
- public uint uCallbackMessage;
- public uint bReserved0;
- public uint bReserved1;
- public IntPtr hIcon;
- }
-
- [Flags]
- public enum FreeType
- {
- Decommit = 0x4000,
- Release = 0x8000,
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct POINT
- {
- public int X;
- public int Y;
-
- public POINT(int x, int y)
- {
- X = x;
- Y = y;
- }
- }
-
- [DllImport(ExternDll.User32, CharSet = CharSet.Auto)]
- [ResourceExposure(ResourceScope.None)]
- public static extern int RegisterWindowMessage(string msg);
-
- [DllImport(ExternDll.User32, SetLastError = true, CharSet = CharSet.Auto)]
- public static extern int MapWindowPoints(IntPtr hWndFrom, IntPtr hWndTo, ref RECT lpPoints, uint cPoints);
-
- [DllImport(ExternDll.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
- public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, out TBBUTTON lpBuffer, int dwSize, out int lpNumberOfBytesRead);
-
- [DllImport(ExternDll.Kernel32, SetLastError = true)]
- public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, out RECT lpBuffer, int dwSize, out int lpNumberOfBytesRead);
-
- [DllImport(ExternDll.Kernel32, SetLastError = true)]
- public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, out TRAYDATA lpBuffer, int dwSize, out int lpNumberOfBytesRead);
-
- [DllImport(ExternDll.User32, CharSet = CharSet.Auto)]
- public static extern uint SendMessage(IntPtr hWnd, uint Msg, uint wParam, IntPtr lParam);
-
- [DllImport(ExternDll.User32, SetLastError = true, CharSet = CharSet.Auto)]
- public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
-
- [DllImport(ExternDll.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
- public static extern IntPtr OpenProcess(ProcessAccess dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, uint dwProcessId);
-
- [DllImport(ExternDll.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
- public static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
-
- [DllImport(ExternDll.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
- public static extern int CloseHandle(IntPtr hObject);
-
- [DllImport(ExternDll.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
- public static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, FreeType dwFreeType);
-
- [DllImport(ExternDll.User32, SetLastError = true)]
- public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
-
- [DllImport(ExternDll.User32, SetLastError = true)]
- public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
-
- [DllImport(ExternDll.User32)]
- public static extern int GetWindowRect(IntPtr hwnd, out RECT lpRect);
-
- [DllImport(ExternDll.User32, CharSet = CharSet.Auto)]
- public static extern bool GetCursorPos(out POINT pt);
-
- [SecurityCritical]
- [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- [DllImport(ExternDll.User32)]
- public static extern int GetSystemMetrics(SM nIndex);
- }
-}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/NativeValues.cs b/src/Shared/HandyControl_Shared/Tools/Interop/NativeValues.cs
deleted file mode 100644
index 94c1e09b..00000000
--- a/src/Shared/HandyControl_Shared/Tools/Interop/NativeValues.cs
+++ /dev/null
@@ -1,235 +0,0 @@
-// ReSharper disable InconsistentNaming
-
-namespace HandyControl.Tools.Interop
-{
- internal enum SM
- {
- CXSCREEN = 0,
- CYSCREEN = 1,
- CXVSCROLL = 2,
- CYHSCROLL = 3,
- CYCAPTION = 4,
- CXBORDER = 5,
- CYBORDER = 6,
- CXFIXEDFRAME = 7,
- CYFIXEDFRAME = 8,
- CYVTHUMB = 9,
- CXHTHUMB = 10,
- CXICON = 11,
- CYICON = 12,
- CXCURSOR = 13,
- CYCURSOR = 14,
- CYMENU = 15,
- CXFULLSCREEN = 16,
- CYFULLSCREEN = 17,
- CYKANJIWINDOW = 18,
- MOUSEPRESENT = 19,
- CYVSCROLL = 20,
- CXHSCROLL = 21,
- DEBUG = 22,
- SWAPBUTTON = 23,
- CXMIN = 28,
- CYMIN = 29,
- CXSIZE = 30,
- CYSIZE = 31,
- CXFRAME = 32,
- CXSIZEFRAME = CXFRAME,
- CYFRAME = 33,
- CYSIZEFRAME = CYFRAME,
- CXMINTRACK = 34,
- CYMINTRACK = 35,
- CXDOUBLECLK = 36,
- CYDOUBLECLK = 37,
- CXICONSPACING = 38,
- CYICONSPACING = 39,
- MENUDROPALIGNMENT = 40,
- PENWINDOWS = 41,
- DBCSENABLED = 42,
- CMOUSEBUTTONS = 43,
- SECURE = 44,
- CXEDGE = 45,
- CYEDGE = 46,
- CXMINSPACING = 47,
- CYMINSPACING = 48,
- CXSMICON = 49,
- CYSMICON = 50,
- CYSMCAPTION = 51,
- CXSMSIZE = 52,
- CYSMSIZE = 53,
- CXMENUSIZE = 54,
- CYMENUSIZE = 55,
- ARRANGE = 56,
- CXMINIMIZED = 57,
- CYMINIMIZED = 58,
- CXMAXTRACK = 59,
- CYMAXTRACK = 60,
- CXMAXIMIZED = 61,
- CYMAXIMIZED = 62,
- NETWORK = 63,
- CLEANBOOT = 67,
- CXDRAG = 68,
- CYDRAG = 69,
- SHOWSOUNDS = 70,
- CXMENUCHECK = 71,
- CYMENUCHECK = 72,
- SLOWMACHINE = 73,
- MIDEASTENABLED = 74,
- MOUSEWHEELPRESENT = 75,
- XVIRTUALSCREEN = 76,
- YVIRTUALSCREEN = 77,
- CXVIRTUALSCREEN = 78,
- CYVIRTUALSCREEN = 79,
- CMONITORS = 80,
- SAMEDISPLAYFORMAT = 81,
- IMMENABLED = 82,
- CXFOCUSBORDER = 83,
- CYFOCUSBORDER = 84,
- TABLETPC = 86,
- MEDIACENTER = 87,
- REMOTESESSION = 0x1000,
- REMOTECONTROL = 0x2001
- }
-
- internal enum CacheSlot
- {
- DpiX,
-
- FocusBorderWidth,
- FocusBorderHeight,
- HighContrast,
- MouseVanish,
-
- DropShadow,
- FlatMenu,
- WorkAreaInternal,
- WorkArea,
-
- IconMetrics,
-
- KeyboardCues,
- KeyboardDelay,
- KeyboardPreference,
- KeyboardSpeed,
- SnapToDefaultButton,
- WheelScrollLines,
- MouseHoverTime,
- MouseHoverHeight,
- MouseHoverWidth,
-
- MenuDropAlignment,
- MenuFade,
- MenuShowDelay,
-
- ComboBoxAnimation,
- ClientAreaAnimation,
- CursorShadow,
- GradientCaptions,
- HotTracking,
- ListBoxSmoothScrolling,
- MenuAnimation,
- SelectionFade,
- StylusHotTracking,
- ToolTipAnimation,
- ToolTipFade,
- UIEffects,
-
- MinimizeAnimation,
- Border,
- CaretWidth,
- ForegroundFlashCount,
- DragFullWindows,
- NonClientMetrics,
-
- ThinHorizontalBorderHeight,
- ThinVerticalBorderWidth,
- CursorWidth,
- CursorHeight,
- ThickHorizontalBorderHeight,
- ThickVerticalBorderWidth,
- MinimumHorizontalDragDistance,
- MinimumVerticalDragDistance,
- FixedFrameHorizontalBorderHeight,
- FixedFrameVerticalBorderWidth,
- FocusHorizontalBorderHeight,
- FocusVerticalBorderWidth,
- FullPrimaryScreenWidth,
- FullPrimaryScreenHeight,
- HorizontalScrollBarButtonWidth,
- HorizontalScrollBarHeight,
- HorizontalScrollBarThumbWidth,
- IconWidth,
- IconHeight,
- IconGridWidth,
- IconGridHeight,
- MaximizedPrimaryScreenWidth,
- MaximizedPrimaryScreenHeight,
- MaximumWindowTrackWidth,
- MaximumWindowTrackHeight,
- MenuCheckmarkWidth,
- MenuCheckmarkHeight,
- MenuButtonWidth,
- MenuButtonHeight,
- MinimumWindowWidth,
- MinimumWindowHeight,
- MinimizedWindowWidth,
- MinimizedWindowHeight,
- MinimizedGridWidth,
- MinimizedGridHeight,
- MinimumWindowTrackWidth,
- MinimumWindowTrackHeight,
- PrimaryScreenWidth,
- PrimaryScreenHeight,
- WindowCaptionButtonWidth,
- WindowCaptionButtonHeight,
- ResizeFrameHorizontalBorderHeight,
- ResizeFrameVerticalBorderWidth,
- SmallIconWidth,
- SmallIconHeight,
- SmallWindowCaptionButtonWidth,
- SmallWindowCaptionButtonHeight,
- VirtualScreenWidth,
- VirtualScreenHeight,
- VerticalScrollBarWidth,
- VerticalScrollBarButtonHeight,
- WindowCaptionHeight,
- KanjiWindowHeight,
- MenuBarHeight,
- VerticalScrollBarThumbHeight,
- IsImmEnabled,
- IsMediaCenter,
- IsMenuDropRightAligned,
- IsMiddleEastEnabled,
- IsMousePresent,
- IsMouseWheelPresent,
- IsPenWindows,
- IsRemotelyControlled,
- IsRemoteSession,
- ShowSounds,
- IsSlowMachine,
- SwapButtons,
- IsTabletPC,
- VirtualScreenLeft,
- VirtualScreenTop,
-
- PowerLineStatus,
-
- IsGlassEnabled,
- UxThemeName,
- UxThemeColor,
- WindowCornerRadius,
- WindowGlassColor,
- WindowGlassBrush,
- WindowNonClientFrameThickness,
- WindowResizeBorderThickness,
-
- NumSlots
- }
-
- internal static class Win32Constant
- {
- internal const int MAX_PATH = 260;
- internal const int INFOTIPSIZE = 1024;
- internal const int TRUE = 1;
- internal const int FALSE = 0;
- }
-}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/UnsafeNativeMethods.cs b/src/Shared/HandyControl_Shared/Tools/Interop/UnsafeNativeMethods.cs
deleted file mode 100644
index 378eab05..00000000
--- a/src/Shared/HandyControl_Shared/Tools/Interop/UnsafeNativeMethods.cs
+++ /dev/null
@@ -1,225 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.InteropServices;
-using System.Security;
-using System.Text;
-
-namespace HandyControl.Tools.Interop
-{
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- internal class UnsafeNativeMethods
- {
- [SecurityCritical]
- [SuppressUnmanagedCodeSecurity]
- [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, EntryPoint = nameof(GetDC), CharSet = CharSet.Auto)]
- public static extern IntPtr IntGetDC(HandleRef hWnd);
-
- [SecurityCritical]
- public static IntPtr GetDC(HandleRef hWnd)
- {
- var hDc = IntGetDC(hWnd);
- if (hDc == IntPtr.Zero)
- {
- throw new Win32Exception();
- }
-
- return HandleCollector.Add(hDc, CommonHandles.HDC);
- }
-
- [SecurityCritical]
- [SuppressUnmanagedCodeSecurity]
- [DllImport(ExternDll.User32, ExactSpelling = true, EntryPoint = nameof(ReleaseDC), CharSet = CharSet.Auto)]
- public static extern int IntReleaseDC(HandleRef hWnd, HandleRef hDC);
-
- [SecurityCritical]
- public static int ReleaseDC(HandleRef hWnd, HandleRef hDC)
- {
- HandleCollector.Remove((IntPtr)hDC, CommonHandles.HDC);
- return IntReleaseDC(hWnd, hDC);
- }
-
- [SecurityCritical]
- [SuppressUnmanagedCodeSecurity]
- [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)]
- public static extern int GetDeviceCaps(HandleRef hDC, int nIndex);
-
- [SecurityCritical]
- [SuppressUnmanagedCodeSecurity]
- [DllImport(ExternDll.User32)]
- public static extern int GetSystemMetrics(SM nIndex);
-
- [SecurityCritical]
- [SuppressUnmanagedCodeSecurity]
- [DllImport(ExternDll.User32, EntryPoint = nameof(DestroyIcon), CharSet = CharSet.Auto, SetLastError = true)]
- private static extern bool IntDestroyIcon(IntPtr hIcon);
-
- [SecurityCritical]
- public static bool DestroyIcon(IntPtr hIcon)
- {
- var result = IntDestroyIcon(hIcon);
- return result;
- }
-
- [SecurityCritical]
- [SuppressUnmanagedCodeSecurity]
- [DllImport(ExternDll.Gdi32, EntryPoint = nameof(DeleteObject), CharSet = CharSet.Auto, SetLastError = true)]
- private static extern bool IntDeleteObject(IntPtr hObject);
-
- [SecurityCritical]
- public static bool DeleteObject(IntPtr hObject)
- {
- var result = IntDeleteObject(hObject);
- return result;
- }
-
- [SecurityCritical]
- public static BitmapHandle CreateDIBSection(HandleRef hdc, ref BITMAPINFO bitmapInfo, int iUsage, ref IntPtr ppvBits, SafeFileMappingHandle hSection, int dwOffset)
- {
- if (hSection == null)
- {
- hSection = new SafeFileMappingHandle(IntPtr.Zero);
- }
-
- var hBitmap = PrivateCreateDIBSection(hdc, ref bitmapInfo, iUsage, ref ppvBits, hSection, dwOffset);
- return hBitmap;
- }
-
- [DllImport(ExternDll.Kernel32, EntryPoint = "CloseHandle", CharSet = CharSet.Auto, SetLastError = true)]
- public static extern bool IntCloseHandle(HandleRef handle);
-
- [SecurityCritical, SuppressUnmanagedCodeSecurity]
- [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto, EntryPoint = nameof(CreateDIBSection))]
- private static extern BitmapHandle PrivateCreateDIBSection(HandleRef hdc, ref BITMAPINFO bitmapInfo, int iUsage, ref IntPtr ppvBits, SafeFileMappingHandle hSection, int dwOffset);
-
- [SecurityCritical, SuppressUnmanagedCodeSecurity]
- [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto, EntryPoint = nameof(CreateIconIndirect))]
- private static extern IconHandle PrivateCreateIconIndirect([In, MarshalAs(UnmanagedType.LPStruct)]ICONINFO iconInfo);
-
- [SecurityCritical]
- public static IconHandle CreateIconIndirect([In, MarshalAs(UnmanagedType.LPStruct)]ICONINFO iconInfo)
- {
- var hIcon = PrivateCreateIconIndirect(iconInfo);
- return hIcon;
- }
-
- [SecurityCritical, SuppressUnmanagedCodeSecurity]
- [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto, EntryPoint = nameof(CreateBitmap))]
- private static extern BitmapHandle PrivateCreateBitmap(int width, int height, int planes, int bitsPerPixel, byte[] lpvBits);
-
- [SecurityCritical]
- internal static BitmapHandle CreateBitmap(int width, int height, int planes, int bitsPerPixel, byte[] lpvBits)
- {
- var hBitmap = PrivateCreateBitmap(width, height, planes, bitsPerPixel, lpvBits);
- return hBitmap;
- }
-
- [SecurityCritical, SuppressUnmanagedCodeSecurity]
- [DllImport(ExternDll.Kernel32, EntryPoint = "GetModuleFileName", CharSet = CharSet.Unicode, SetLastError = true)]
- private static extern int IntGetModuleFileName(HandleRef hModule, StringBuilder buffer, int length);
-
- [SecurityCritical]
- internal static string GetModuleFileName(HandleRef hModule)
- {
- var buffer = new StringBuilder(Win32Constant.MAX_PATH);
- while (true)
- {
- var size = IntGetModuleFileName(hModule, buffer, buffer.Capacity);
- if (size == 0)
- {
- throw new Win32Exception();
- }
-
- if (size == buffer.Capacity)
- {
- buffer.EnsureCapacity(buffer.Capacity * 2);
- continue;
- }
-
- return buffer.ToString();
- }
- }
-
- [SecurityCritical, SuppressUnmanagedCodeSecurity]
- [DllImport(ExternDll.Shell32, CharSet = CharSet.Auto, BestFitMapping = false, ThrowOnUnmappableChar = true)]
- internal static extern int ExtractIconEx(string szExeFileName, int nIconIndex, out IconHandle phiconLarge, out IconHandle phiconSmall, int nIcons);
-
- [DllImport(ExternDll.Shell32, CharSet = CharSet.Auto)]
- public static extern int Shell_NotifyIcon(int message, NOTIFYICONDATA pnid);
-
- [SecurityCritical]
- [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- [DllImport(ExternDll.User32, SetLastError = true, CharSet = CharSet.Unicode, EntryPoint = "CreateWindowExW")]
- public static extern IntPtr CreateWindowEx(
- int dwExStyle,
- [MarshalAs(UnmanagedType.LPWStr)] string lpClassName,
- [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName,
- int dwStyle,
- int x,
- int y,
- int nWidth,
- int nHeight,
- IntPtr hWndParent,
- IntPtr hMenu,
- IntPtr hInstance,
- IntPtr lpParam);
-
- [SecurityCritical]
- [SuppressUnmanagedCodeSecurity]
- [DllImport(ExternDll.User32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
- public static extern short RegisterClass(WNDCLASS wc);
-
- [DllImport(ExternDll.User32, CharSet = CharSet.Auto)]
- public static extern IntPtr DefWindowProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
-
- [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)]
- public static extern bool SetForegroundWindow(IntPtr hWnd);
-
- [DllImport(ExternDll.User32, CharSet = CharSet.Auto, SetLastError = true)]
- public static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam);
-
- [DllImport(ExternDll.Kernel32, CharSet = CharSet.Auto, SetLastError = true)]
- public static extern IntPtr GetModuleHandle(string lpModuleName);
-
- [DllImport(ExternDll.User32, CharSet = CharSet.Auto, SetLastError = true)]
- public static extern bool UnhookWindowsHookEx(IntPtr hhk);
-
- public enum HookType
- {
- WH_KEYBOARD_LL = 13,
- WH_MOUSE_LL = 14
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct MOUSEHOOKSTRUCT
- {
- public NativeMethods.POINT pt;
- public IntPtr hwnd;
- public uint wHitTestCode;
- public IntPtr dwExtraInfo;
- }
-
- public delegate IntPtr HookProc(int code, IntPtr wParam, IntPtr lParam);
-
- [DllImport(ExternDll.User32, CharSet = CharSet.Auto, SetLastError = true)]
- public static extern IntPtr SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hMod, uint dwThreadId);
-
- [DllImport(ExternDll.User32, SetLastError = true)]
- public static extern IntPtr GetDesktopWindow();
-
- [DllImport(ExternDll.User32, SetLastError = true)]
- public static extern IntPtr GetWindowDC(IntPtr window);
-
- [DllImport(ExternDll.Gdi32, SetLastError = true)]
- public static extern uint GetPixel(IntPtr dc, int x, int y);
-
- [DllImport(ExternDll.User32, SetLastError = true)]
- public static extern int ReleaseDC(IntPtr window, IntPtr dc);
-
- [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)]
- public static extern int GetDeviceCaps(IntPtr hdc, int nIndex);
-
- [DllImport(ExternDll.User32, CharSet = CharSet.Auto)]
- public static extern IntPtr GetDC(IntPtr ptr);
- }
-}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/WNDCLASS.cs b/src/Shared/HandyControl_Shared/Tools/Interop/WNDCLASS.cs
deleted file mode 100644
index 33dd3903..00000000
--- a/src/Shared/HandyControl_Shared/Tools/Interop/WNDCLASS.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.InteropServices;
-
-namespace HandyControl.Tools.Interop
-{
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- [SuppressMessage("ReSharper", "IdentifierTypo")]
- internal class WNDCLASS
- {
- public int style;
- public WndProc lpfnWndProc;
- public int cbClsExtra;
- public int cbWndExtra;
- public IntPtr hInstance;
- public IntPtr hIcon;
- public IntPtr hCursor;
- public IntPtr hbrBackground;
- public string lpszMenuName;
- public string lpszClassName;
- }
-}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/RegularPatterns.cs b/src/Shared/HandyControl_Shared/Tools/RegularPatterns.cs
index 4ff94eb6..7226a6b0 100644
--- a/src/Shared/HandyControl_Shared/Tools/RegularPatterns.cs
+++ b/src/Shared/HandyControl_Shared/Tools/RegularPatterns.cs
@@ -89,7 +89,7 @@
///
/// 计算性质数字正则匹配
///
- public const string DigitsPattern = @"^[+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)([eE][+-]?[0-9]+)?$";
+ public const string DigitsPattern = @"[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?";
///
/// 正整数正则匹配