Fish in the river

思考 技术
记录 回忆
  1. Main page
  2. 软件开发
  3. C#
  4. Main content

wpf 使用CommunityToolKit.Mvvm实现命令

2024年2月5日 94hotness 0likes 0comments

接上一个文章,我们在上一个文章中使用CommunityToolKit.Mvvm写了绑定验证。我们在这篇文章中,写一下MVVM模式下的Command.即命令。

这一章节是我花时间最长的一个章节。主要原因是CommunityTookKit.Mvvm的模式下与MvvmLight的EventToCommand有较大的区别。如果有人参考这篇文章的话,一定要注意,引用的几个Nuget包。一个都不能少,要不然,你会发现调试不通。

还是那句老话,写程序一定要用成熟的技术。千万别用一些小众的框架。要不,到时有你受的。

同上篇文章,这篇文章的实现来自这位大神的文章。我只是将他原来使用mvvmLight的框架使用CommunityToolKit重新实现了一遍。但是在EventToCommad的部分是与他不同的,有些引用不同。要特别注意。

大神的文章如下。

https://www.cnblogs.com/wzh2010/p/6518834.html

重写的Demo源码如下。在Visual studio2022 + .net 6.0下编译实现。

立即下载
Tag: C#
Last updated:2024年2月5日

joey

This person is a lazy dog and has left nothing

Like
< Last article
Next article >

Comments

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
Cancel

归档

  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024

分类目录

  • C#
  • Dock
  • Excel
  • Kindle
  • Linux
  • Windows
  • 生活感悟
  • 群晖
  • 运维技术

COPYRIGHT © 2024 水中小鱼. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang