Implementing Common Scenarios with MVVM

Many common scenarios are easy to implement when writing your View's logic in its code-behind, because you have full control over the View. However, once you start using the MVVM design pattern and have a clean separation of concerns between the View's look and its logic/behavior, implementing these scenarios requires a bit more thought. Let's look at how you can “control” the View from the ViewModel and solve some of the implementation issues commonly faced when using the MVVM design pattern.

How Do I Assign a Value to a Control's Property?

When writing code-behind, you would typically assign a control's property like so:

NameTextBox.Text = "Chris Anderson";

When using the MVVM design pattern, instead ...

Get Pro Business Applications with Silverlight 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.