This project has moved and is read-only. For the latest updates, please go here.

How I can map behavior to Commands?

Apr 7, 2012 at 3:47 PM

Hi,

Is there a way  to mapping UI element behaviors to ViewModel commands? For example double click event of a datagrid.

Thanks.

Apr 11, 2012 at 9:07 PM
Edited Apr 11, 2012 at 9:07 PM

The BookLibrary sample application shows how to execute a command when the user double clicks an item in a ListView.
Maybe that’s what you are looking for:

BookLibrary.Library.Presentation.Views.LendToWindow.xaml.cs

private void PersonsListMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
    ViewModel.OkCommand.Execute(null);
}