Event bindings

Docking/MDI for WPF Forum

Posted 8 years ago by Michael Bayer
Version: 16.1.0633


with ribbon buttons I'm able to bind the Click event to a command like as follows:

<ribbon:Button Label="DoAnything" Command="{Binding DoAnythingCommand}"/>

I guess, this works, because the Click event is the default event of the button.

Is there an equivalent approach to bind events like DockSite.WindowsClosed using MVVM?



[Modified 8 years ago]

Comments (1)

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


In general, buttons fire their Command when clicked and also raise a Click event, but other than them both executing when a click occurs, they aren't related.  DockSite's WindowClosed event is a normal event and can be handled the same as any other .NET event. 

This site has a good tutorial on attaching to event handlers from XAML:


There isn't a command available for when windows are closed though.  Your view would have to handle the event and then in its handler, call whatever it needs to on your view model.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.