Tuesday, 15 September 2009

MVVM: Silverlight versus WPF

In order to use the Command model for Silverlight it is necessary to download the Prism for Silverlight extensions

Silverlight Prism extension

Alternatively it is possible to place a click event inside view behind on Silverlight view then cast Datacontext to ViewModel and execute methods

add to the View code behind

Button_Click(object sender,RoutedEventArgs e)
{
var data = this.DataContext as ViewModel;

data.MyMethod();
}

No comments:

Post a Comment