[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Collapse]Build an Application
  [Expand]Choose Application UI
  [Expand]Printing and Exporting
  [Collapse]WinForms MVVM
   [Expand]Design-time Support
     Lesson 1 - Creating The Project. Scaffolding Wizard.
     Lesson 2 - Creating Views
     Lesson 3 - Navigation and Services
     Lesson 4 - Data Binding
     Lesson 5 - Login Form
     Lesson 6 - Lookup Editors and Master Detail
     Lesson 7 - Additional Functionality
  [Expand]Right-to-Left Layout
   Redistribution and Deployment
   How to: Perform Actions On Application Startup
 [Expand]Controls and Libraries
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Lesson 1 - Creating The Project. Scaffolding Wizard.

In this lesson you will start creating the sample application built according the MVVM pattern and learn how to use the Scaffolding Wizard.

  1. Create a new WinForms application. To create your project's Data Model, add a new Model folder and use the code snippets below to create three classes – Account, Transaction and Category. These classes use Data Annotation Attributes and require the System.ComponentModel.DataAnnotations library to be included in your project.

    Account Data Model

    Category Data Model

    Transaction Data Model

  2. Go to the Visual Studio's Project menu and select the Manage NuGet Packages... menu item. Search for the Entity Framework 6 package in the online storage and click 'Install'. Note that without this NuGet package installed, you will be unable to work with entity models in this sample application.

  3. Add the following DbContext class descendant that will serve as the context for the DevExpress Scaffolding Wizard.

  4. Before proceeding to the next step, build your project and make sure it compiles without errors. Then, right-click your project in the Visual Studio Solution Explorer and select Add DevExpress Item - Data Model Scaffolding... (see the figure below). This will launch the Scaffolding Wizard, which will generate the complete application hierarchy, including the MVVM-ready DataModel from your data context.


    If this menu item is missing, right-click your project and select the default Visual Studio Add - New Item... option. In the dialog, select the DevExpress Template Gallery and manually launch the Scaffolding Wizard - choose the Data Model Scaffolding tab (the WinForms Data Models group) and click the Run Wizard button in the bottom right corner.

    In the Wizard dialog, select the context created in the second step and click Next. Check all required tables and views, then click Finish to launch model generation.

  5. As a result, you will see many new files, folders and classes added to your application.

    Do not panic, you will never have to touch most of these files. At this moment, only two folders generated by the Wizard are worth mentioning - the DataModel folder that contains your CRUD data model and the ViewModels folder that contains MVVM ViewModels for each table within the DbContext - Account, Category and Transaction. In the following lesson, you will learn how to create Views for these ViewModels.

Expanded See Also

Is this topic helpful?​​​​​​​