diff --git a/README.md b/README.md
index cdd97043..13d7245e 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,10 @@ Step 4:enjoy coding
## Latest examples
+### ButtonGroup
+
+
+
### Grid

@@ -79,12 +83,12 @@ Step 4:enjoy coding

+## History publication
+
### WaveProgressBar

-## History publication
-
### Badge

diff --git a/Resources/ButtonGroup.png b/Resources/ButtonGroup.png
new file mode 100644
index 00000000..25041947
Binary files /dev/null and b/Resources/ButtonGroup.png differ
diff --git a/Resources/RadioButton.png b/Resources/RadioButton.png
index 4641a6f8..4f1308e5 100644
Binary files a/Resources/RadioButton.png and b/Resources/RadioButton.png differ
diff --git a/doc/source/_posts/home.md b/doc/source/_posts/home.md
index 34ebe0d8..cec7679d 100644
--- a/doc/source/_posts/home.md
+++ b/doc/source/_posts/home.md
@@ -4,8 +4,6 @@ title: 欢迎来到HandyOrg
HandyOrg的宗旨是为用户提供最简单的API。
-目前组织成员只有一人。
-
我们一直期待着有更多的同学加入。
我们的入坑要求:
diff --git a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
index 3a6182e6..d384531c 100644
--- a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
+++ b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
@@ -352,6 +352,9 @@
Resources\Img\LeftMainContent\brackets_Square_16xLG.png
+
+ Resources\Img\LeftMainContent\ButtonGroup_16x.png
+
diff --git a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
index 61536a9e..82e5ee46 100644
--- a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
+++ b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
@@ -395,6 +395,9 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\ButtonGroup_16x.png
+
Resources\Img\LeftMainContent\brackets_Square_16xLG.png
diff --git a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
index 57947a1f..36a1fec2 100644
--- a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
+++ b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
@@ -457,6 +457,9 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\ButtonGroup_16x.png
+
Resources\Img\LeftMainContent\brackets_Square_16xLG.png
diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
index 10cb3212..72b30cf2 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
@@ -98,6 +98,8 @@
public static readonly string RangeSliderDemoCtl = nameof(RangeSliderDemoCtl);
+ public static readonly string ButtonGroupDemoCtl = nameof(ButtonGroupDemoCtl);
+
public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl);
public static readonly string RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl);
diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
index 23421817..56b9b0f5 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
@@ -51,7 +51,8 @@ var controlList = new List
"DialogDemoCtl",
"SideMenuDemoCtl",
"GridDemoCtl",
- "RangeSliderDemoCtl"
+ "RangeSliderDemoCtl",
+ "ButtonGroupDemoCtl"
};
var styleList = new List
{
diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
index 86a11012..8f0e0adb 100644
--- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
+++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
@@ -56,6 +56,9 @@
BadgeDemoCtl.xaml
+
+ ButtonGroupDemoCtl.xaml
+
CalendarWithClockDemoCtl.xaml
@@ -413,6 +416,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
index d4b6a070..14840212 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
@@ -177,6 +177,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 按钮组 的本地化字符串。
+ ///
+ public static string ButtonGroup {
+ get {
+ return ResourceManager.GetString("ButtonGroup", resourceCulture);
+ }
+ }
+
///
/// 查找类似 日历 的本地化字符串。
///
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
index 68dc57fe..c16cb5c0 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
@@ -618,4 +618,7 @@
Off
+
+ ButtonGroup
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
index 84a43c24..3e44c0b1 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
@@ -618,4 +618,7 @@
关
+
+ 按钮组
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/ButtonGroup_16x.png b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/ButtonGroup_16x.png
new file mode 100644
index 00000000..e1e3b904
Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/ButtonGroup_16x.png differ
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ButtonGroupDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ButtonGroupDemoCtl.xaml
new file mode 100644
index 00000000..dd6faccd
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ButtonGroupDemoCtl.xaml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ButtonGroupDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ButtonGroupDemoCtl.xaml.cs
new file mode 100644
index 00000000..833fc39d
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ButtonGroupDemoCtl.xaml.cs
@@ -0,0 +1,40 @@
+using System.Windows;
+using System.Windows.Media.Imaging;
+
+namespace HandyControlDemo.UserControl
+{
+ public partial class ButtonGroupDemoCtl
+ {
+ public ButtonGroupDemoCtl()
+ {
+ InitializeComponent();
+ }
+
+ public static readonly DependencyProperty SourceProperty = DependencyProperty.Register(
+ "Source", typeof(BitmapFrame), typeof(Avatar), new PropertyMetadata(default(BitmapFrame)));
+
+ public BitmapFrame Source
+ {
+ get => (BitmapFrame) GetValue(SourceProperty);
+ set => SetValue(SourceProperty, value);
+ }
+
+ public static readonly DependencyProperty UserNameProperty = DependencyProperty.Register(
+ "DisplayName", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
+
+ public string DisplayName
+ {
+ get => (string) GetValue(UserNameProperty);
+ set => SetValue(UserNameProperty, value);
+ }
+
+ public static readonly DependencyProperty LinkProperty = DependencyProperty.Register(
+ "Link", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
+
+ public string Link
+ {
+ get => (string) GetValue(LinkProperty);
+ set => SetValue(LinkProperty, value);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
index ebcdc91b..34e51788 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
@@ -210,6 +210,11 @@
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/OverView.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/OverView.xaml
index e903a4e7..48031c00 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/OverView.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/OverView.xaml
@@ -58,31 +58,31 @@
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/RadioButtonDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/RadioButtonDemoCtl.xaml
index 2b5e794b..6f886ded 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/RadioButtonDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/RadioButtonDemoCtl.xaml
@@ -20,31 +20,31 @@
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/RadioGroup.cs b/src/Shared/HandyControl_Shared/Controls/Other/ButtonGroup.cs
similarity index 71%
rename from src/Shared/HandyControl_Shared/Controls/Other/RadioGroup.cs
rename to src/Shared/HandyControl_Shared/Controls/Other/ButtonGroup.cs
index 86a22690..dd190f61 100644
--- a/src/Shared/HandyControl_Shared/Controls/Other/RadioGroup.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Other/ButtonGroup.cs
@@ -1,17 +1,16 @@
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
using HandyControl.Tools;
namespace HandyControl.Controls
{
- public class RadioGroup : ItemsControl
+ public class ButtonGroup : ItemsControl
{
- protected override DependencyObject GetContainerForItemOverride() => new RadioButton();
-
- protected override bool IsItemItsOwnContainerOverride(object item) => item is RadioButton;
+ protected override bool IsItemItsOwnContainerOverride(object item) => item is Button || item is RadioButton || item is ToggleButton;
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
- "Orientation", typeof(Orientation), typeof(RadioGroup), new PropertyMetadata(default(Orientation)));
+ "Orientation", typeof(Orientation), typeof(ButtonGroup), new PropertyMetadata(default(Orientation)));
public Orientation Orientation
{
@@ -20,7 +19,7 @@ namespace HandyControl.Controls
}
public static readonly DependencyProperty ItemStyleSelectorProperty = DependencyProperty.Register(
- "ItemStyleSelector", typeof(StyleSelector), typeof(RadioGroup), new PropertyMetadata(new RadioGroupItemStyleSelector()));
+ "ItemStyleSelector", typeof(StyleSelector), typeof(ButtonGroup), new PropertyMetadata(new ButtonGroupItemStyleSelector()));
public StyleSelector ItemStyleSelector
{
@@ -35,9 +34,9 @@ namespace HandyControl.Controls
var count = Items.Count;
for (var i = 0; i < count; i++)
{
- var item = (RadioButton)Items[i];
+ var item = (ButtonBase)Items[i];
item.Style = ItemStyleSelector?.SelectStyle(item, this);
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Shared/HandyControl_Shared/Data/ResourceToken.cs b/src/Shared/HandyControl_Shared/Data/ResourceToken.cs
index a8ebcb90..4ec115bd 100644
--- a/src/Shared/HandyControl_Shared/Data/ResourceToken.cs
+++ b/src/Shared/HandyControl_Shared/Data/ResourceToken.cs
@@ -52,6 +52,30 @@
internal const string RadioGroupItemVerticalLast = nameof(RadioGroupItemVerticalLast);
+ internal const string ButtonGroupItemDefault = nameof(ButtonGroupItemDefault);
+
+ internal const string ButtonGroupItemSingle = nameof(ButtonGroupItemSingle);
+
+ internal const string ButtonGroupItemHorizontalFirst = nameof(ButtonGroupItemHorizontalFirst);
+
+ internal const string ButtonGroupItemHorizontalLast = nameof(ButtonGroupItemHorizontalLast);
+
+ internal const string ButtonGroupItemVerticalFirst = nameof(ButtonGroupItemVerticalFirst);
+
+ internal const string ButtonGroupItemVerticalLast = nameof(ButtonGroupItemVerticalLast);
+
+ internal const string ToggleButtonGroupItemDefault = nameof(ToggleButtonGroupItemDefault);
+
+ internal const string ToggleButtonGroupItemSingle = nameof(ToggleButtonGroupItemSingle);
+
+ internal const string ToggleButtonGroupItemHorizontalFirst = nameof(ToggleButtonGroupItemHorizontalFirst);
+
+ internal const string ToggleButtonGroupItemHorizontalLast = nameof(ToggleButtonGroupItemHorizontalLast);
+
+ internal const string ToggleButtonGroupItemVerticalFirst = nameof(ToggleButtonGroupItemVerticalFirst);
+
+ internal const string ToggleButtonGroupItemVerticalLast = nameof(ToggleButtonGroupItemVerticalLast);
+
internal const string TabItemCapsuleDefault = nameof(TabItemCapsuleDefault);
internal const string TabItemCapsuleSingle = nameof(TabItemCapsuleSingle);
diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
index 368a727b..fc045ed5 100644
--- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
+++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
@@ -18,6 +18,7 @@
+
@@ -77,7 +78,6 @@
-
@@ -278,7 +278,7 @@
-
+
@@ -466,7 +466,7 @@
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
@@ -662,7 +662,7 @@
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ButtonBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ButtonBaseStyle.xaml
index 1e992ef9..26ada988 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ButtonBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ButtonBaseStyle.xaml
@@ -46,4 +46,45 @@
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioGroupBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ButtonGroupBaseStyle.xaml
similarity index 71%
rename from src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioGroupBaseStyle.xaml
rename to src/Shared/HandyControl_Shared/Themes/Styles/Base/ButtonGroupBaseStyle.xaml
index 4d702304..10084ad6 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioGroupBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ButtonGroupBaseStyle.xaml
@@ -2,24 +2,25 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls">
-
+
-
+
-
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioButtonBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioButtonBaseStyle.xaml
index 39ffaf97..26c893c6 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioButtonBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/RadioButtonBaseStyle.xaml
@@ -196,9 +196,15 @@
-
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ToggleButtonBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ToggleButtonBaseStyle.xaml
index 7aa084cf..206dd44e 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/ToggleButtonBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/ToggleButtonBaseStyle.xaml
@@ -1,6 +1,7 @@
+ xmlns:controls="clr-namespace:HandyControl.Controls"
+ xmlns:system="clr-namespace:System;assembly=mscorlib">
@@ -218,4 +219,53 @@
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml
index 238edc28..75a96a7c 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml
@@ -81,4 +81,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/RadioGroup.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/ButtonGroup.xaml
similarity index 70%
rename from src/Shared/HandyControl_Shared/Themes/Styles/RadioGroup.xaml
rename to src/Shared/HandyControl_Shared/Themes/Styles/ButtonGroup.xaml
index 3a6d2a00..9db91779 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/RadioGroup.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/ButtonGroup.xaml
@@ -3,12 +3,12 @@
xmlns:controls="clr-namespace:HandyControl.Controls">
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/StyleSelector/ButtonGroupItemStyleSelector.cs b/src/Shared/HandyControl_Shared/Tools/StyleSelector/ButtonGroupItemStyleSelector.cs
new file mode 100644
index 00000000..5edb7597
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/StyleSelector/ButtonGroupItemStyleSelector.cs
@@ -0,0 +1,87 @@
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using HandyControl.Controls;
+using HandyControl.Data;
+
+namespace HandyControl.Tools
+{
+ public class ButtonGroupItemStyleSelector : StyleSelector
+ {
+ public override Style SelectStyle(object item, DependencyObject container)
+ {
+ if (container is ButtonGroup buttonGroup && item is ButtonBase buttonBase)
+ {
+ var count = buttonGroup.Items.Count;
+
+ switch (buttonBase)
+ {
+ case RadioButton _:
+ {
+ if (count == 1)
+ {
+ return ResourceHelper.GetResource