Table of Contents

Basics of the 'Model View Viewmodel' Pattern (MVVM)

Model–view–viewmodel (MVVM) is an architectural pattern that facilitates the separation of the development of the graphical user interface (GUI; the view) from the development of the business logic or back-end logic (the model) such that the view is not dependent upon any specific model platform. 1

MVVM

By default the LisRT framework uses the Caliburn.Micro framework for the easy, clean and fast use of the MVVM pattern.

Important

You must add the AssemblySourceAttribute to your assembly so that a ViewModel's view can be found.

Example: AssemblyInfo.cs

[assembly: AssemblySource]

Conventions

To find the View for a ViewModel, you must fulfill the following naming conventions:

  • The name of the ViewModel class must end with 'ViewModel'. The name of the View class must end with 'View'.
  • The namespaces for ViewModels must end with '.ViewModels' and the namespaces for Views must end with '.Views.'
ViewModel View
Convention <RootNamespace>.ViewModels.<EntityName>ViewModel <RootNamespace>.Views.<EntityName>View
Example MyApp.ViewModels.AppViewModel MyApp.Views.AppView

For more details about the naming conventions see the CaliburnMicro documentation.

Working with Composite ViewModels

A ViewModel can contain other ViewModels. These inner ViewModels can be bound to a ContentControl in the View.

public class SampleViewModel
{
    public SubViewModel SubViewModelInstance { get; } = new SubViewModel();
}

See Also

Other Resources