devexpress WinForms MVVM
WinForms MVVM
This section is dedicated to the Model-View-ViewModel (MVVM) architectural pattern. You will find all required info about its basic concepts and ways to implement it in WinForms applications. The 'Tutorials' group contains multiple step-by-step tutorials that accumulate theoretical concepts from the 'Concepts' group to create a sample application, built entirely in accordance to all MVVM concepts.
What is MVVM?
The MVVM pattern is well-known among WPF developers. The main idea of this pattern is separating your application into three semi-independent layers.
- Model - the data layer. Refers either to a domain model, which represents the real state content (an object-oriented approach), or to the data access layer that represents that content (a data-centric approach).
- View - the user interface layer. Contains all elements displayed by the application GUI (buttons, panels, labels, editors, etc.).
- ViewModel - the nexus between a Model and a View. This layer is an abstraction of the View that exposes public properties and commands, used to bind your data to GUI elements and manage this data.
The diagram below illustrates MVVM layers and their communication means.
By separating the graphical user interface from the business logic, this pattern provides multiple advantages, such as more efficient code management (e.g., covering it with unit tests) or the ability to modify the application interface without needing to touch your business logic.
MVVM in WinForms. Presenter.
The MVVM pattern was introduced specifically for the WPF platform. WinForms developers who will try to follow its concepts will eventually face multiple major issues, for instance:
- data binding in WinForms is more complex and less agile;
- WinForms platform features only events and methods instead of bindable WPF commands.
These issues force WinForms developers to write a decent amount of additional code behind. This code is often considered as a separate fourth layer - Presenter. Presenter manages all interaction between a ViewModel and a View that goes beyond simple command bindings and extends the "pure" MVVM pattern into MVPVM.
Typically, the Presenter layer includes the following:
- UserControls and their code behind;
- internal classes;
- methods that tweak and customize controls within the View;
- event handlers;
- bindings;
- other specific code snippets.
Thus, the WinForms platform has multiple limitations, which ultimately meand that WinForms developers will have to code more. The DevExpress MVVM Framework offers another way of overcoming all the mentioned issues.
![]()
DevExpress MVVM Framework
Since MVVM is nothing more than a concept rather than a set of strict rules to follow, developers can implement it differently depending on their needs. Many third-party vendors offer different approaches to introduce these concepts to your application development. DevExpress makes no difference has its own vision of MVVM and its own framework to implement it.
What truly excels the DevExpress MVVM Framework is its cross-platform nature: the one framework to develop both WPF and WinForms apps with ease and elegance. This framework extends the WinForms platform and grants it the following features, which it originally lacks:
- flexible data bindings;
- commands and command bindings;
- behaviors and services;
- an advanced way to implement notifications and commands.
Other benefits are:
- the MVVM Context component, available from the toolbox that simplifies creating MVVM applications;
- POCO classes support;
- rich interoperability with other DevExpress WinForms controls;
- Template Gallery templates, created specifically for MVVM apps;
- fluent API and Data Annotation Attributes support;
- various design time capabilities.
All these features allow you to create an almost "pure" MVVM application and get rid of the Presenter layer (and thus of excessive code).
![]()
MVVM Learning Center
The MVVM pattern can be tricky to learn for developers that have never used it before. To ensure your quick start into MVVM development, this documentation is bound with the 'MVVM Best Practices' demo, available from the DevExpress Demo Center. This demo contains dozens of small samples, grouped into modules. Every document from the 'Concepts' section has a code sample and a notification that shows which demo example is linked to this text block. Thus, instead of copying code samples to your test application, you can simply launch the demo, choose the related module and check out how this or that feature works. The following figure illustrates regions of this demo.
- Module Chooser. Selects the current demo module. Each module contains multiple examples, dedicated to the specific topic (e.g., data bindings or commands). There are three groups of demo modules:
- API Code Examples. Each module from this section contains tiny samples that illustrate how most basic tasks are implemented.
- Navigation. This group contains modules that illustrate how to build the sample 'Expenses' application based on various services. The Tutorials section contains tutorials that help you to create this sample app all by yourself.
- Views. Modules in this group illustrate edit forms from the sample 'Expenses' application built using different layout controls.
- Example Chooser. Lists all examples, available for the selected module.
- Live Example Code. Highlights the code region that provides the target functionality, illustrated in this example. You can modify this code right in the demo window.
- Preview Section. An example preview, updated on the fly in accordance to the code from the Live Example Code region.
- Run In Visual Studio. Launches your Visual Studio with the currently viewed example as a project. This allows you to observe the entire example code.
The entire demo is also available as a separate Support Center example. Coupled with this documentation section, the MVVM Best Practices demo creates a powerful learning center for you to discover the DevExpress MVVM Framework and test it on live examples at the same time.
![]()
MVVM Documentation Sections
- Concepts
This section gathers
documents that illustrate how to implement most basic tasks using the DevExpress
Framework: bind properties, create and bind commands, use triggers to update one
UI element in accordance to another, convert values of bindable properties,
implement layer communication and much more. - Design-time Support
Includes
articles that introduce design-time features that allow you to code less. The Control-based Services topic describes in
details all DevExpress services, first mentioned in the Services document. - Tutorials
A set of step-by-step
tutorials that guide you through the process of creation of the sample
'Expenses' application.
devexpress WinForms MVVM的更多相关文章
- DevExpress WinForms使用教程:皮肤颜色和LookAndFeel
[DevExpress WinForms v18.2下载] v18.2版本中更改了控制背景颜色和皮肤一起处理的方式.在v18.1中引入了Project Settings页面,其中包含一个skin se ...
- Devexpress Winform MVVM
归纳总结备忘 Devexpress Winform MVVM Practice 前言 MVVM Devexpress 正文 databindings及 UI Triggers Command 委托Co ...
- DevExpress WinForms使用教程:SVG图库和Image Picker
[DevExpress WinForms v18.2下载] 每个新版本都在几个新控件中引入了矢量图标支持. 对于v18.2,这是列表: BackstageViewControl及其项目 RecentI ...
- DevExpress WinForms使用教程:Ribbon性能
[DevExpress WinForms v18.2下载] DevExpress XAF团队提供Ribbon新能改进,其中XAF Office Module的实际应用程序需要花费很长时间才能加载,导致 ...
- DevExpress WinForms使用教程:新的CheckEdit样式
[DevExpress WinForms v18.2下载] 在最开始CheckEdit控件有16种样式, 使用CheckStyle属性,开发人员可以选择其中一种样式.随着时间推移,与其他Windows ...
- DevExpress WinForms使用教程:Diagram Control
[DevExpress WinForms v18.2下载] DevExpress WinForms v18.2包含WinForms和WPF Diagram Controls的三个高要求功能:新的Dia ...
- DevExpress WinForms使用教程:Data Grid - Find Panel模式
[DevExpress WinForms v18.2下载] DevExpress WinForms用户都熟知,Data Grid是整个产品线的主要产品.在v18.2中添加了一些新的功能,例如之前教程中 ...
- DevExpress WinForms使用教程:图表控件 - 内置深入查询
[DevExpress WinForms v18.2下载] 在最新发布的DevExpress WinForms v18.2中,DevExpress WinForms和ASP.NET图表控件引入嵌套系列 ...
- DevExpress WinForms使用教程:WinForms Sunburst控件
[DevExpress WinForms v18.2下载] DevExpress WinForms v18.2中包含了一个新的WinForms组件 - WinForms Sunburst,它旨在帮助开 ...
随机推荐
- easyui中的几个问题
easyui中的tree,采用url参数读取json,无法显示.有可能是vs的IIS不支持,$.ajax 原因待测试,有知道的朋友也可以贴代码,我解决的一个办法是 $(function () { $. ...
- SSM综合练习
CRM系统 CRM项目外观 1. 开发环境 IDE: Eclipse Neon Release (4.6.0) Jdk: 1.8 数据库: MySQL 2. 创建数据库 创建crm数据库,这里使用的是 ...
- CSS----盒子模型与浮动
盒模型(框模型) 页面上任何一个元素我们都可以看成是一个盒子,盒子会占用一定的空间和位置他们之间相互制约,就形成了网页的布局 w3c的盒模型的构成:content border padding ma ...
- 2018面向对象程序设计(Java)第3周学习指导及要求
2018面向对象程序设计(Java) 第3周学习指导及要求(2018.9.11-2018.9.16) 学习目标 适应老师教学方式,能按照自主学习要求完成本周理论知识学习: 掌握Java Appli ...
- openlayers/// Puppeteer.js
1.定位;https://viglino.github.io/ol3-ext/examples/map.interaction.geolocationdraw.html 2 .添加Overlay d ...
- metasploit framework(十四):弱点扫描
vnc 密码破解 vnc 端口5900 先开启数据库 启动msf vnc无密码访问 RDP远程桌面漏洞 win7 192.168.1.123 xp 192.168.1.122 发现有两个模块, ...
- PHP 在 Mac 的安装之路
半年前本以为有一些 Apache 和 PHP 的安装经验,今天在 Mac 上还是踩了很多坑. 坦诚地讲,这东西入门成本比 Node,Python 入门成本真的是大很多. Apache 的编译安装就是那 ...
- jenkin、SVN、archery集成openLDAP
jenkins: 1.下载.安装插件 LDAP .Matrix Authorization Strategy 2. 系统管理 —> 全局安全配置 点击 启用安全,并且选择 LDAP 认证,这里有 ...
- Centos 7 下 Corosync + Pacemaker + psc + HA-proxy 实现业务高可用
一.介绍: 1.本博客Corosync + Pacemaker + psc + HA-proxy 实现业务高可用,以httpd 服务实现高可用为例. 2.架构思路 a.三台web 节点,功能:全部安装 ...
- numpy 之矩阵的认知
di numpy 矩阵的创建与应用 可以用np.mat(a) 将a转变成矩阵 矩阵的加减法和 array相同 矩阵的乘法,如果矩阵要相乘的话就要A矩阵的行数,和B矩阵的列数相同才可以 这是查看数组不重 ...