WPF MVVM 动态创建控件

上传者: ryb666666 | 上传时间: 2021-06-18 15:58:56 | 文件大小: 71KB | 文件类型: ZIP
在有一些项目中,UI界面上的控件有时是在程序运行时才生成的。这样的功能在MVVM中也很容易实现。并且可以通过按钮取得其值。   本实例主要实现程序运行时,在界面上生成四个控件,两个TextBox和两个TextBlock.并且点击按钮时,弹出TextBox中的值

文件下载

资源详情

[{"title":"( 39 个子文件 71KB ) WPF MVVM 动态创建控件","children":[{"title":"WpfMvvmAutoCreatControl","children":[{"title":"WpfMvvmAutoCreatControl","children":[{"title":"Command","children":[{"title":"AutoControlCommand.cs <span style='color:#111;'> 730B </span>","children":null,"spread":false}],"spread":true},{"title":"App.xaml <span style='color:#111;'> 334B </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl.csproj <span style='color:#111;'> 4.34KB </span>","children":null,"spread":false},{"title":"obj","children":[{"title":"x86","children":[{"title":"Debug","children":[{"title":"WpfMvvmAutoCreatControl_MarkupCompile.i.lref <span style='color:#111;'> 93B </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl.pdb <span style='color:#111;'> 43.50KB </span>","children":null,"spread":false},{"title":"App.g.cs <span style='color:#111;'> 2.20KB </span>","children":null,"spread":false},{"title":"MainWindow.baml <span style='color:#111;'> 1.41KB </span>","children":null,"spread":false},{"title":"MainWindow.g.cs <span style='color:#111;'> 3.39KB </span>","children":null,"spread":false},{"title":"DesignTimeResolveAssemblyReferencesInput.cache <span style='color:#111;'> 6.25KB </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl_MarkupCompile.i.cache <span style='color:#111;'> 328B </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl.Properties.Resources.resources <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"GenerateResource.read.1.tlog <span style='color:#111;'> 178B </span>","children":null,"spread":false},{"title":"TempPE","children":[{"title":"Properties.Resources.Designer.cs.dll <span style='color:#111;'> 4.50KB </span>","children":null,"spread":false}],"spread":false},{"title":"App.g.i.cs <span style='color:#111;'> 2.20KB </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl_MarkupCompile.lref <span style='color:#111;'> 93B </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl.exe <span style='color:#111;'> 13.00KB </span>","children":null,"spread":false},{"title":"GeneratedInternalTypeHelper.g.cs <span style='color:#111;'> 2.85KB </span>","children":null,"spread":false},{"title":"MainWindow.g.i.cs <span style='color:#111;'> 3.39KB </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl.g.resources <span style='color:#111;'> 1.64KB </span>","children":null,"spread":false},{"title":"GenerateResource.write.1.tlog <span style='color:#111;'> 438B </span>","children":null,"spread":false},{"title":"GeneratedInternalTypeHelper.g.i.cs <span style='color:#111;'> 2.85KB </span>","children":null,"spread":false},{"title":"DesignTimeResolveAssemblyReferences.cache <span style='color:#111;'> 10.11KB </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl.csproj.FileListAbsolute.txt <span style='color:#111;'> 1.62KB </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl_MarkupCompile.cache <span style='color:#111;'> 329B </span>","children":null,"spread":false}],"spread":false}],"spread":true}],"spread":true},{"title":"bin","children":[{"title":"Debug","children":[{"title":"WpfMvvmAutoCreatControl.pdb <span style='color:#111;'> 43.50KB </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl.vshost.exe <span style='color:#111;'> 11.33KB </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl.vshost.exe.manifest <span style='color:#111;'> 490B </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl.exe <span style='color:#111;'> 13.00KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"App.xaml.cs <span style='color:#111;'> 319B </span>","children":null,"spread":false},{"title":"MainWindow.xaml <span style='color:#111;'> 867B </span>","children":null,"spread":false},{"title":"ViewModel","children":[{"title":"AutoControlViewModel.cs <span style='color:#111;'> 3.46KB </span>","children":null,"spread":false}],"spread":true},{"title":"Properties","children":[{"title":"AssemblyInfo.cs <span style='color:#111;'> 2.16KB </span>","children":null,"spread":false},{"title":"Settings.Designer.cs <span style='color:#111;'> 1.08KB </span>","children":null,"spread":false},{"title":"Resources.resx <span style='color:#111;'> 5.48KB </span>","children":null,"spread":false},{"title":"Settings.settings <span style='color:#111;'> 201B </span>","children":null,"spread":false},{"title":"Resources.Designer.cs <span style='color:#111;'> 2.83KB </span>","children":null,"spread":false}],"spread":true},{"title":"MainWindow.xaml.cs <span style='color:#111;'> 638B </span>","children":null,"spread":false}],"spread":true},{"title":"WpfMvvmAutoCreatControl.suo <span style='color:#111;'> 31.00KB </span>","children":null,"spread":false},{"title":"WpfMvvmAutoCreatControl.sln <span style='color:#111;'> 911B </span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

  • wangde4587 :
    后台代码生成,实用性一般
    2021-08-24
  • lcm6054 :
    很简单,但实用,能学到点东西。
    2020-02-25
  • qq_34511791 :
    这样的生成太鸡肋了
    2019-11-19
  • gulo_endy :
    就这么个东西,我还以为是什么神密的黑科技呢
    2017-11-13
  • a258600607 :
    参考参考,只是东西不多
    2016-06-17

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明