MVVM简单应用实践(一)

0. MVVM介绍及前置知识上图来自维基。组成要素:Model:表示具体数据内容(represents real state content)View:界面展示View Model:View的抽象,提供公共属性和命令(an abstraction of the view exposing public properties and commands)Binder:(a view directly binds to properties on the view model to send and
摘要由CSDN通过智能技术生成

0. MVVM介绍及前置知识

在这里插入图片描述
上图来自维基。组成要素:

  • Model:表示具体数据内容(represents real state content)
  • View:界面展示
  • View Model:View的抽象,提供公共属性和命令(an abstraction of the view exposing public properties and commands),业务代码
  • Binder:(a view directly binds to properties on the view model to send and receive updates.)

界面交互方式:

  • 通过 RoutedEvents 响应
  • 通过命令Command(Commands provides glue between View and ViewModel for interactivity)

1. 初始工作

首先建立三个文件夹,用以存放Command、ViewModel和View
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-JsUfnxGh-1598865469396)(C8A854E7B6DC49898282E64AE92BC2DE)]

2. 创建view

在这里插入图片描述

在MainWindow.xaml中添加如下代码

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值