diff --git a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
index ad7fbab1c..a463f64c5 100644
--- a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
+++ b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
@@ -417,6 +417,9 @@
Resources\Img\thumbs_up.png
+
+ Resources\Img\SplitButton_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 ba107c4e7..3c9f45394 100644
--- a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
+++ b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
@@ -429,6 +429,9 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\SplitButton_16x.png
+
Resources\Img\LeftMainContent\thumbs_up.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 2287cbee7..dfa44c93a 100644
--- a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
+++ b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
@@ -492,6 +492,9 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\SplitButton_16x.png
+
Resources\Img\LeftMainContent\thumbs_up.png
diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
index 3ffee119a..7f8f0df7e 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
@@ -116,6 +116,8 @@ public class MessageToken
public static readonly string FloatingBlockDemoCtl = nameof(FloatingBlockDemoCtl);
+ public static readonly string SplitButtonDemoCtl = nameof(SplitButtonDemoCtl);
+
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 2978eea6e..b2e1f2835 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
@@ -60,7 +60,8 @@ var controlList = new List
"HoneycombPanelDemoCtl",
"SpriteDemoCtl",
"NotificationDemoCtl",
- "FloatingBlockDemoCtl"
+ "FloatingBlockDemoCtl",
+ "SplitButtonDemoCtl"
};
var styleList = new List
{
diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
index cddc13cc4..a1c92435c 100644
--- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
+++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
@@ -183,6 +183,9 @@
SideMenuDemoCtl.xaml
+
+ SplitButtonDemoCtl.xaml
+
SpriteDemoCtl.xaml
@@ -621,6 +624,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 71c11a57a..a5c6c81e2 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
@@ -1401,6 +1401,15 @@ public class Lang {
}
}
+ ///
+ /// 查找类似 分割按钮 的本地化字符串。
+ ///
+ public static string SplitButton {
+ get {
+ return ResourceManager.GetString("SplitButton", resourceCulture);
+ }
+ }
+
///
/// 查找类似 精灵 的本地化字符串。
///
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
index 5114bdd63..3159b7daa 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
@@ -663,4 +663,7 @@
FloatingBlock
+
+ SplitButton
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx
index 07d9c0ff1..5c85dabaf 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx
@@ -663,4 +663,7 @@
FloatingBlock
+
+ SplitButton
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx
index ff7f70f8e..6963d7afc 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx
@@ -663,4 +663,7 @@
FloatingBlock
+
+ SplitButton
+
\ 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 c3c1bec73..4da168526 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
@@ -663,4 +663,7 @@
漂浮块
+
+ 分割按钮
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/SplitButton_16x.png b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/SplitButton_16x.png
new file mode 100644
index 000000000..80e46664e
Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/SplitButton_16x.png differ
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 000000000..944a9d6ae
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SplitButtonDemoCtl.xaml
@@ -0,0 +1,6 @@
+
+
+
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 000000000..45ead5927
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SplitButtonDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class SplitButtonDemoCtl
+ {
+ public SplitButtonDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
index e5d1313cd..4f903dd17 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
@@ -225,6 +225,11 @@
+
+
+
+
+
@@ -330,7 +335,7 @@
-
+
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 000000000..e3ad2892c
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Button/SplitButton.cs
@@ -0,0 +1,18 @@
+using System.Windows;
+using System.Windows.Controls.Primitives;
+using HandyControl.Data.Enum;
+
+namespace HandyControl.Controls
+{
+ public class SplitButton : ButtonBase
+ {
+ public static readonly DependencyProperty HitModeProperty = DependencyProperty.Register(
+ "HitMode", typeof(MouseHitMode), typeof(SplitButton), new PropertyMetadata(default(MouseHitMode)));
+
+ public MouseHitMode HitMode
+ {
+ get => (MouseHitMode) GetValue(HitModeProperty);
+ set => SetValue(HitModeProperty, value);
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/TransitioningContentControl.cs b/src/Shared/HandyControl_Shared/Controls/Other/TransitioningContentControl.cs
index 64c0cf752..fe84b94a1 100644
--- a/src/Shared/HandyControl_Shared/Controls/Other/TransitioningContentControl.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Other/TransitioningContentControl.cs
@@ -4,6 +4,7 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Markup;
using System.Windows.Media.Animation;
using HandyControl.Data;
using HandyControl.Tools;
@@ -14,7 +15,8 @@ namespace HandyControl.Controls
[TemplateVisualState(GroupName = PresentationGroup, Name = DefaultTransitionState)]
[TemplatePart(Name = PreviousContentPresentationSitePartName, Type = typeof(ContentControl))]
[TemplatePart(Name = CurrentContentPresentationSitePartName, Type = typeof(ContentControl))]
- public class TransitioningContentControl : ContentControl
+ [ContentProperty("Content")]
+ public class TransitioningContentControl : Control
{
private Storyboard _currentTransition;
@@ -76,11 +78,28 @@ public override void OnApplyTemplate()
VisualStateManager.GoToState(this, Transition, true);
}
- protected override void OnContentChanged(object oldContent, object newContent)
+ public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(
+ "Content", typeof(object), typeof(TransitioningContentControl), new PropertyMetadata(default(object), OnContentChanged));
+
+ private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
- base.OnContentChanged(oldContent, newContent);
+ var ctl = (TransitioningContentControl) d;
+ ctl.StartTransition(e.OldValue, e.NewValue);
+ }
- StartTransition(oldContent, newContent);
+ public static readonly DependencyProperty ContentTemplateProperty = DependencyProperty.Register(
+ "ContentTemplate", typeof(DataTemplate), typeof(TransitioningContentControl), new PropertyMetadata(default(DataTemplate)));
+
+ public DataTemplate ContentTemplate
+ {
+ get => (DataTemplate) GetValue(ContentTemplateProperty);
+ set => SetValue(ContentTemplateProperty, value);
+ }
+
+ public object Content
+ {
+ get => GetValue(ContentProperty);
+ set => SetValue(ContentProperty, value);
}
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "newContent", Justification = "Should be used in the future.")]
diff --git a/src/Shared/HandyControl_Shared/Data/Enum/MouseHitMode.cs b/src/Shared/HandyControl_Shared/Data/Enum/MouseHitMode.cs
new file mode 100644
index 000000000..6232328a5
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Data/Enum/MouseHitMode.cs
@@ -0,0 +1,8 @@
+namespace HandyControl.Data.Enum
+{
+ public enum MouseHitMode
+ {
+ Click,
+ Hover
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
index 6aa8a1700..898fddd7e 100644
--- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
+++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
@@ -21,6 +21,7 @@
+
@@ -34,6 +35,7 @@
+
@@ -390,6 +392,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -778,6 +784,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
MSBuild:Compile
Designer
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 000000000..273e9fe9b
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/SplitButtonBaseStyle.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
\ 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 000000000..f72a35d09
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/SplitButton.xaml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
\ 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 aaa1a79ce..46347ec28 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
@@ -74,6 +74,7 @@
+
\ 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 81fb9f6ac..0e238931a 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/TransitioningContentControl.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/TransitioningContentControl.xaml
@@ -11,7 +11,7 @@
-
+
@@ -76,29 +76,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+