Home

Awesome

View Model Code Generator

The DevExpress MVVM Framework includes a source generator that produces boilerplate code for your View Models at compile time. You need to define a stub View Model class that defines the required logic. Our MVVM Framework analyzes your implementation and applied attributes to generate the final View Model class with all required boilerplate code.

Prerequisites

Your project should meet the following requirements:

Prepare Your Project

Prepare your project as outlined below to enable support for View Models generated at compile time:

  1. Add a reference to the DevExpress.Mvvm.v21.1+ or install the DevExpress.Mvvm NuGet package.

  2. Install the DevExpress.Mvvm.CodeGenerators NuGet package in your project.

  3. Set the language version to 9 in the .csproject file:

    <PropertyGroup>
        <LangVersion>9</LangVersion>
    </PropertyGroup>
    

    For .NET Core projects, set the IncludePackageReferencesDuringMarkupCompilation property to true additionally:

    <PropertyGroup>
        <IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
    </PropertyGroup>
    

Documentation

Refer to the following topic for more information:

Example

Refer to the following GitHub example: