Event bindings

Docking/MDI for WPF Forum

Posted 8 years ago by Michael Bayer
Version: 16.1.0633
Avatar

Hi,

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?

Thanks

Michael

[Modified 8 years ago]

Comments (1)

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

Hello,

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:

http://www.wpf-tutorial.com/xaml/events-in-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.1) 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.