Showing posts with label Design Patterns. Show all posts
Showing posts with label Design Patterns. Show all posts

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
}

Tuesday, September 29, 2009

Design Patterns

MVVM - Model-View-View Model
The controller is replaced with a view model. the view model sits below the UI layer. The view model exposes the data and command objects that the view needs. You could think of this as a container object that view goes to to get its data and actions from. The view model pulls its data from the model(s) below.

MVC - Model–View–Controller
The view sits at the top of the architecture, the controller sits below the view. The model sits below the controller. So the view knows about the controller, the controller knows the model. The view is notified when the model changes.

MVP - Model-View-Presenter
The controller is replaced with a presenter. The presenter sits at the same level as the view. The presenter listens to the events of both the view and the model and mediates the interactions between both the view and model.

About Me

My photo
simple and straight forward