SplitButton click event

Ribbon for WPF Forum

Posted 8 years ago by Kasper
Version: 11.2.0552
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar

Hi guys,

I have a SplitButton with a Click event, as well as a menu with items with their own Click event. When I click the arrow on the SplitButton and then on one of the menu items (Ribbon Button), the event of the menu item is fired, but right there after, the event of the SplitButton is fired. Is this really by design? I would only expect the Click event of the SplitButton to be fired when clicking directly on it and not on a child item.

Comments (3)

Answer - Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

I don't believe the SplitButton itself raises the Click event.  Perhaps it's just the other one bubbling up, as many WPF events do.  Check the event's source to see.


Actipro Software Support

Posted 8 years ago by Kasper
Avatar

Yes the Source is the button in the menu I clicked. I don't understand how the two relate though? Does this mean that I have to set the Handled property each and everytime I deal with a button that might be a part of a menu??

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

It sounds like it's just standard WPF event bubbling.  Yes, when you handle an event that bubbles, you might want to set e.Handled = true to prevent it from continuing to bubble.  Or you can just ignore it if you see the source doesn't come from the element you think it should be from.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.