当前位置: 首页 > news >正文

做a视频 免费网站深圳网站建设公司哪里有

做a视频 免费网站,深圳网站建设公司哪里有,做外贸网站如何,腾讯企点是干嘛的前言 我一直想组件化得去开发WPF#xff0c;因为我觉得将复杂问题简单化是最好的 如何组件化开发 主窗口引用 Window x:ClassWpfApp1.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.…前言 我一直想组件化得去开发WPF因为我觉得将复杂问题简单化是最好的 如何组件化开发 主窗口引用 Window x:ClassWpfApp1.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:localclr-namespace:WpfApp1xmlns:MDhttp://materialdesigninxaml.net/winfx/xaml/themesxmlns:Viewsclr-namespace:WpfApp1.Viewsmc:IgnorabledTitleMainWindow Height450 Width800 Window.ResourcesStyle x:Keymy_text TargetTypeTextBlockSetter PropertyFontSize Value30 /Setter PropertyMargin Value8 //Style/Window.ResourcesWindow.DataContext !--需要命名来指定数据源--local:MainWindowViewModel x:NameviewModel//Window.DataContextGrid!--不能直接写TitleValueBinding数据源会有问题--Views:ViewA Margin10Title{Binding ElementNameviewModel,PathTitleValue} //Grid /Window cs部分 namespace WpfApp1 {/// summary/// Interaction logic for MainWindow.xaml/// /summarypublic partial class MainWindow : Window{public MainWindow(){InitializeComponent();}}public class MainWindowViewModel{public string TitleValue { get; set; } 我是测试数据;} }控件窗口 UserControl.DataContextlocal:ViewAViewModel //UserControl.DataContextGridTextBlock Text{Binding Title} //Grid/// summary /// ViewA.xaml 的交互逻辑 /// /summary public partial class ViewA : UserControl {public static readonly DependencyProperty TitleProperty;/// summary/// 为了拿到数据源需要定义一下/// /summaryprivate ViewAViewModel ViewModel new ViewAViewModel();public ViewA(){InitializeComponent();ViewModel (ViewAViewModel)DataContext;}static ViewA(){//静态构造TitleProperty DependencyProperty.Register(Title, typeof(string), typeof(ViewA),new PropertyMetadata(,new PropertyChangedCallback((item, res) {//拿到数据再次赋值var model (ViewA)item;model.ViewModel.Title (string)res.NewValue;})));}/// summary/// 只是为了有代码提示添加依赖属性后不会被调用/// /summarypublic string Title { get; set; }} public partial class ViewAViewModel : ObservableObject {/// summary/// 通知更新/// /summary[ObservableProperty]private string title ViewA Title!;}依赖注入代码优化 我将复杂的依赖注入的代码进行了优化减少了重复内容的输入。 //原代码 TitleProperty DependencyProperty.Register(Title, typeof(string), typeof(ViewA), new PropertyMetadata(default,new PropertyChangedCallback((item, res) {//拿到数据再次赋值var model (ViewA)item;model.ViewModel.Title (string)res.NewValue;})));//新代码TitleProperty DependencyPropertySetViewA, string(Title, (view, value) {view.ViewModel.Title value;});/// summary /// 简化依赖注入代码 /// /summary /// typeparam nameView/typeparam /// typeparam nameValue/typeparam /// param namename/param /// param nameaction/param /// returns/returns public static DependencyProperty DependencyPropertySetView,Value(string name,ActionView,Value action) where View : class {var res DependencyProperty.Register(name, typeof(Value), typeof(View), new PropertyMetadata(default,new PropertyChangedCallback((item, res) {var model item as View;var value (Value)res.NewValue;if(model ! null){action(model, value);}else{throw new Exception(model value is null);}})));return res; }
http://www.sadfv.cn/news/358592/

相关文章:

  • 东莞容桂网站制作购买网站需要注意什么
  • 新西兰注册公司做网站晏阳初乡村建设网站
  • 在谷歌上网站推广wordpress搭论坛
  • 米枫网站怎么做分页vs2013怎么做网站
  • 在荔浦找事情做投简历那个网站opencms wordpress
  • 最火爆的国际贸易网站如何给网站挂黑链
  • 汕头免费网站制作网页制作用哪个软件
  • 网站建设完工后在什么科目核算住建部证书查询大厅
  • 工业网站模板wordpress转帝国
  • 微商网站模板做网站打算套用模板
  • 适合新手做的网站项目网站建设需要些什么设备
  • 常熟网站开发网站设置字体样式
  • 上海网站设计图片网站建设的合同书
  • 哪家做网站最便宜做优化关键词
  • 句容市建设局网站wordpress 斜杠
  • 四大门户网站的区别外贸培训
  • 临沂网站制作建设淘宝网站内站建设现状
  • 商城网站设计策划怎么使用服务器做网站
  • 网站开发的企业软件外包服务公司是做什么的
  • 免费免费网站模板下载网站丰台网站建设联系方式
  • .net 获取网站域名wordpress电商主题搭建
  • 汕头做网站优化公司微信公众号免费编辑器
  • 制作网页网站的软件是网站建设费用选网络专业
  • 上海老闵行网站建设captcha wordpress
  • 佛山网站优化方法软件wordpress数字资源下载会员
  • 官方网站下载游戏建旅游网站多少钱
  • 类似享设计的网站wordpress多语言主页
  • 个人网站 备案 广告东莞建设网站公司简介
  • 南昌自助建站室内装修设计软件vr
  • 中国化学工程第九建设公司网站当前最新域名