登录
首页 » .NET » MVVM: 关闭对话框

MVVM: 关闭对话框

于 2022-08-21 发布 文件大小:2.83 MB
0 158
下载积分: 2 下载次数: 1

代码说明:

翻译 maninwest@Codeforge 作者 Cornelius Henning@Codeproject 我学习  MVVM 时遇到一个意外问题,关闭对话框时不如在旧的 WPF 中简单, 尤其是当你想避免背后的代码时。在此示例中,所有代码都在视图的 ViewModel 类中。 使用代码 整个项目是个可下载的 zip 文件。该项目是在Visual Studio 2012 中进行的,针对 .NET 4.5 平台。如要查看演示,请解压缩文件并进行构建。运行时,会显示一个用户,具有一个包含一个按钮的主窗口。单击按钮会打开新的具有两个按钮的对话窗口。单击任何一个按钮会执行有限的代码,然后对话框会关闭。 请注意,为了提高可读性,代码已经少得不能再少了。处理运行时错误的意外手柄也减到最少。如果你要使用此代码,务必要确保最终代码稳健且可处理任何意外或其他错误。 此代码中无使用的约束条件。你可以使用全部或者部分。 实现的说明 对话框的关闭由附加的属性控制。属性设置为 true 时,对话框会关闭。.以下是注册附加事件的代码: using System; using System.Windows; namespace MvvmDialogDemo.AttachedProperty { public static class CloseDialog { public static readonly DependencyProperty DialogResultProperty = DependencyProperty.RegisterAttached("DialogResult", typeof(Boolean?), typeof(CloseDialog),new PropertyMetadata(DialogResultChanged)); private static void DialogResultChanged (DependencyO

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • clock
    说明:  .net工程,一个openvg的demo,想学openvg的同学很有帮助(an openvg demo based on .net)
    2009-08-25 10:20:53下载
    积分:1
  • PersonalBlog
    1)通过两个抽象表存放任何数据实体以及实体之间的关系; 2)通过两种扩展字段设计方式实现任何数据实体的字段扩展需要,并且扩展的字段支持数据库级别的排序搜索功能;扩展字段的添加和一般字段没有什么大的区别,仅仅只是添加了一个特性而已。 3)由于将实体与实体之间的关系进行高度抽象(最终抽象为横向和父子递归两种关系),导致数据库访问层的接口的通用型非常广泛,可以适应任何实体之间的关系。这样的设计用一般的言语无法表达;也许你看了代码之后会有所体会; 4)吸取了CS中的很多好的设计,如Provider模式,动态构建SQL实现自定义查询,缓存,多语言资源文件设计,自定义Url重写,Ajax功能,etc; 5)优秀的运行性能; 6)通过一个简单的文章发布系统的后台管理系统作为Demo,展示本框架的部分功能; 7)目前该框架还在不断完善优化中。(1) to store any data entities and the relationship between two abstract table 2) fields of any data entity expansion needs in two extended field design approach, and extended field support database level sort search function add extension field and the general field no big difference, just add a feature. 3) the relationship between the entity and the entity to a high degree of abstraction (the final abstract horizontal and parent-child recursive two), resulting in the interface of the database access layer, Universal is very extensive, and can be adapted to the relationship between any entities. This design can not be expressed in general language maybe you looked at the code will be the experience 4) draw a lot of good design in CS, such as the Provider mode, dynamically build the SQL to implement a custom query cache, the design of multi-language resource files, custom Url rewrite, Ajax functionality, etc. 5) excellent operational performance 6) release system in the backg)
    2012-04-05 11:54:22下载
    积分:1
  • 《viusal c++教程》(郑阿奇主编)的Ex_SDI源码
    《viusal c++教程》(郑阿奇主编)的Ex_SDI源码
    2022-12-01 07:10:04下载
    积分:1
  • 是一个窗体移动的标准代码,简单明了, 易用易懂
    是一个窗体移动的标准代码,简单明了, 易用易懂-Is a standard form of mobile code, simple and clear, easy-to-use easy-to-understand
    2022-03-12 23:16:04下载
    积分:1
  • SmartTank
    基于.net的智能坦克(Smart tank)游戏程序源码,也可作为游戏编程入门范例(Based. Net intelligent tanks (Smart tank) game program source code, can be used as examples of game programming entry)
    2013-07-25 10:09:05下载
    积分:1
  • 所有文章均来自www.nssoft.net的Delphi知识库。
    所有文章均来自www.nssoft.net的Delphi知识库。-All articles are from the Delphi Knowledge www.nssoft.net.
    2022-08-16 02:42:55下载
    积分:1
  • 国外优秀的在线教育系统CMS
    本人在GIThub 深度寻找到的,国内ASP几乎没有。强烈推荐,SQL+ASP。net  MVC .....
    2023-01-10 19:10:27下载
    积分:1
  • net报表打印程序
    完善的.net 报表程序,具有打印、打印预览等各种功能
    2023-04-24 10:35:03下载
    积分:1
  • 663488
    用vb实现的系统时间程序,学vb的同学可以看看,用到很多控件(Using vb to realize the system time program, learn from vb students can see, use a lot of controls)
    2018-12-05 09:22:58下载
    积分:1
  • 这是罗斌编写的VC2005编程技巧大全的源代码(2)。
    这是罗斌编写的VC2005编程技巧大全的源代码(2)。-This is a Luo VC2005 prepared programming skills Guinness source code (2).
    2022-03-17 11:32:11下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载