background preloader

MVVM

Facebook Twitter

RelayCommand, Yes Another One! « TypeCasted. Using System; using <span class="skimlinks-unlinked">System.Threading.Tasks</span>; using <span class="skimlinks-unlinked">System.Windows.Input</span>; namespace Commanding public class RelayCommand : ICommand #region Private Data Members /// <summary> /// Flag indicates that the command should be run on a seperate thread /// </summary> private readonly bool mRunOnBackGroudThread; /// Predicate that that evaluates if this command can be executed private readonly Predicate<object> mCanExecutePredicate; /// Action to be taken when this command is executed private readonly Action<object> mExecuteAction; /// Run when action method is complete and run on a seperate thread private readonly Action<object> mExecuteActionComplete; #endregion #region Constructor /// Initializes a new instance of the <see cref="RelayCommand"/> class. /// <param name="canExecutePredicate">The can execute predicate. /// <param name="executeAction">The execute action.

RelayCommand, Yes Another One! « TypeCasted

5: Implementing the MVVM Pattern. The Model-View-ViewModel (MVVM) pattern helps you to cleanly separate the business and presentation logic of your application from its user interface (UI).

5: Implementing the MVVM Pattern

Maintaining a clean separation between application logic and UI helps to address numerous development and design issues and can make your application much easier to test, maintain, and evolve. It can also greatly improve code re-use opportunities and allows developers and UI designers to more easily collaborate when developing their respective parts of the application. Using the MVVM pattern, the UI of the application and the underlying presentation and business logic is separated into three separate classes: the view, which encapsulates the UI and UI logic; the view model, which encapsulates presentation logic and state; and the model, which encapsulates the application's business logic and data.

This chapter provides an overview of the MVVM pattern and describes how to implement its fundamental characteristics.

Caliburn.Micro

How to Implement MVVM, INotifyChanged and ICommand in a Silverlight Application - Arrange Act Assert. In this post we will be converting an application that adds two numbers together to use the MVVM (Model-View-ViewModel) pattern as part of the How To Refactor And Build Better Microsoft Silverlight Applications series.

How to Implement MVVM, INotifyChanged and ICommand in a Silverlight Application - Arrange Act Assert

The code used in this post can be downloaded here. Why MVVM? While I could write about what MVVM is, I would just be repeating what Josh Smith and Jesse Liberty have already covered in the ‘WPF Apps With The Model-View-ViewModel Design Pattern’ MSDN article and the ‘MVVM – It’s Not Kool-Aid*’ blog post. I like the MVVM pattern because it helps me to write code and develop solutions that: keeps my code behind files as code free as possiblecan be unit testedare simpler to read and understandare less headache to maintainadhere to good programming principlesmake validation easier to implement It’s important to remember MVVM isn’t the solution to every problem.

Catel - Part 0 of n: Why choose Catel? Download source code from CodePlex Article browser Table of contents 1.

Catel - Part 0 of n: Why choose Catel?

Introduction Welcome to part 0 of the article series about Catel. This article tries to explain why you should use Catel as the (or one of the) frameworks when developing WPF, Silverlight, and Windows Phone 7 applications. This article is separated into several sections, one general one, and the rest is specific for the different frameworks that are targeted by Catel. This article is not about in-depth explanations of all the functionality. 2. 2.1. We care a lot about the freedom you need as a software developer. During the development of Catel, we tried to maintain this freedom aspect which is very important to us.

As an example: you have a legacy application and want to use the DataWindow to write simple entry windows, but you are not ready for MVVM yet. Most frameworks require a bootstrapper that completely decides how your application structure should look like. 2.2. A Simple MVVM Example « Rachel Lim's Blog. In my opinion, if you are using WPF or Silverlight you should be using the MVVM design pattern.

A Simple MVVM Example « Rachel Lim's Blog

It is perfectly suited to the technology and allows you to keep your code clean and easy to maintain. The problem is, there are a lot of online resources for MVVM, each with their own way of implementing the design pattern and it can be overwhelming. I would like to present MVVM in the simplest way possible using just the basics. So lets start at the beginning. MVVM is short for Model-View-ViewModel. Models are simple class objects that hold data.