Thursday, October 15, 2009

Caliburn: An Application Framework for WPF

Today, I've learned how to use caliburn framework in Model-View-View Model(MVVM) designed pattern.
Without using the application framework, you can set your event in your view.xaml by this:



in your view.cs, you need to hard code this:
void MouseEnter(object sender, MouseEventArgs e)
{
//code here
}

using the implementation above, it breaks the rule of MVVM, the view classes have no idea that the model classes exist, while the ViewModel and model are unaware of the view.

but using caliburn, you need to add this to your view.xaml by



in your viewmodel.cs,
public void OnMouseEnter(MouseEventArgs e)
{
//code here
}

No comments:

Post a Comment

About Me

My photo
simple and straight forward