1. 将相关的 UserControl 添加到“Views”文件夹的每个子文件夹中。

2. 将MvvmContext组件拖放到每个用户控件上,将相关的ViewModel(AccountViewModel、CategoryViewModel 和 TransactionViewModel)设置为每个组件的子ViewModel。

4. 添加 DataLayoutControl 后,它将自动调用数据源选择器对话框(见下图),使用它将每个用户控件的 DataLayoutControls 绑定到相关模型 – Account、Category 和 Transaction。

您也可以直接在 Designer.cs 代码中手动更改此设置,如下所示。

C#

//Make sure the DataSourceUpdateMode is set to OnPropertyChangedthis.NameTextEdit.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.accountBindingSource, "Name", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));this.AmountTextEdit.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.accountBindingSource, "Amount", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

VB.NET

'Make sure the DataSourceUpdateMode is set to OnPropertyChangedMe.NameTextEdit.DataBindings.Add(New System.Windows.Forms.Binding("EditValue", Me.accountBindingSource, "Name", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))Me.AmountTextEdit.DataBindings.Add(New System.Windows.Forms.Binding("EditValue", Me.accountBindingSource, "Amount", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))

7. 添加管理收藏条目的功能区项目,为此请使用所需的命令填充功能区,就像您之前使用详细视图所做的那样。

现在,当所有所需类型的视图都准备好时,您可以继续下一部分 – 导航。

DevExpress WinForm | 下载试用

DevExpress WinForm拥有180+组件和UI库,能为Windows Forms平台创建具有影响力的业务解决方案。DevExpress WinForms能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,还是分析处理大批量的业务数据,它都能轻松胜任!

更多产品正版授权详情及优惠,欢迎咨询在线客服>>


DevExpress技术交流群5:742234706      欢迎一起进群讨论

DevExpress企业定制服务
标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2022年1月12日
下一篇 2022年1月12日

相关推荐

发表回复

登录后才能评论