MVVM View vs. Control

Sunday, November 3, 2013

In the MVVM world, Views are attached to ViewModels. How can a view be implemented? Typical answers for say, WPF, are: Window, User Control and Data Template. Similar answers exist for Windows Phone and Windows 8, where “Window” may be dropped or replaced by Page.This is certainly true, but about that User Control? Can any user control automatically be considered a View? Not quite.The distinction between view and control (user control or otherwise) is based on reusability and dependency. A View requires a ViewModel to give it context. A View cannot function without a ViewModel. Typical XAML View would...
no comments

WPF 4.5: Markup Extension for Events

Saturday, April 7, 2012

One of the new features coming in WPF 4.5 (already available through the Visual Studio 11 Beta and .NET 4.5 Beta) is the ability to create markup extensions that work on events (as opposed to properties, which have always had this capability). Markup extensions for properties are crucial, and there are quite a few useful ones, such as {Binding} and {StaticResource}. Would this ability be useful for events? One such case is when a command is needed to be invoked (ICommand) because of some event, typically found in MVVM scenarios. The problem is that only some events can actually...
tags: , , , , ,
no comments