diff --git a/src/Avalonia.Controls/SplitButton/SplitButton.cs b/src/Avalonia.Controls/SplitButton/SplitButton.cs
index 8e32d46820..4cacc2789f 100644
--- a/src/Avalonia.Controls/SplitButton/SplitButton.cs
+++ b/src/Avalonia.Controls/SplitButton/SplitButton.cs
@@ -30,7 +30,8 @@ namespace Avalonia.Controls
///
/// Defines the event.
///
- public static readonly RoutedEvent ClickEvent = Button.ClickEvent;
+ public static readonly RoutedEvent ClickEvent =
+ RoutedEvent.Register(nameof(Click), RoutingStrategies.Bubble);
///
/// Defines the property.
@@ -384,7 +385,7 @@ namespace Avalonia.Controls
// Note: It is not currently required to check enabled status; however, this is a failsafe
if (IsEffectivelyEnabled)
{
- var eventArgs = new RoutedEventArgs(Button.ClickEvent);
+ var eventArgs = new RoutedEventArgs(ClickEvent);
RaiseEvent(eventArgs);
if (!eventArgs.Handled && Command?.CanExecute(CommandParameter) == true)
@@ -417,6 +418,8 @@ namespace Avalonia.Controls
///
private void PrimaryButton_Click(object? sender, RoutedEventArgs e)
{
+ // Handle internal button click, so it won't bubble outside together with SplitButton.ClickEvent.
+ e.Handled = true;
OnClickPrimary(e);
}
@@ -425,6 +428,8 @@ namespace Avalonia.Controls
///
private void SecondaryButton_Click(object? sender, RoutedEventArgs e)
{
+ // Handle internal button click, so it won't bubble outside.
+ e.Handled = true;
OnClickSecondary(e);
}