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

杭州人防质监站网址上海红酒网站建设

杭州人防质监站网址,上海红酒网站建设,商务网站建设评估的指标,wordpress文章文字连接其实#xff0c;在wpf中#xff0c;最核心的就是xaml#xff0c;因为只有xaml#xff0c;才能体现出用的是wpf#xff0c;而不是普通的cs文件#xff0c;cs文件在winform中等等程序都可以使用的#xff0c;唯独xaml才是wpf中最重要的#xff0c;最精华的东西#xff0…        其实在wpf中最核心的就是xaml因为只有xaml才能体现出用的是wpf而不是普通的cs文件cs文件在winform中等等程序都可以使用的唯独xaml才是wpf中最重要的最精华的东西但是xaml说深也深说浅也浅很多人都是用winform的做法去开发wpf从效果上看没有任何区别的。 今天说一下wpf中的资源其实也属于xaml中的内容万物皆资源。在资源中我们可以插入UC控件以及ViewModel。 1.首先创建一个wpf程序 2. 把UC控件当做资源来使用 2.1首先创建一个UC界面 2.2在App.xaml中把它当做资源 Application x:ClassWpfApp2.Appxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:localclr-namespace:WpfApp2StartupUriMainWindow.xamlApplication.ResourcesResourceDictionarylocal:UserControl1 x:KeyucTest/ResourceDictionary.MergedDictionaries/ResourceDictionary.MergedDictionaries/ResourceDictionary/Application.Resources /Application2.3在主界面直接调用 Window x:ClassWpfApp2.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:WpfApp2mc:IgnorabledTitleMainWindow Height450 Width800GridContentControl Content{StaticResource ucTest} //Grid /Window2.4 效果 此时其实就是把UC控件充当了引用界面的方式效果一毛一样。  3.把ViewModel当做资源来使用 3.1接着上面的代码继续我们采用简单的MVVM模式 建立MainViewModel using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows.Data;namespace WpfApp2 {public class MainViewModel : BindingBase{public MainViewModel(){}private string name 故里2130;public string Name{get { return name; }set{name value; OnPropertyChanged();//OnPropertyChanged(nameof(name),使用特性去掉括号的值}}}public class BindingBase : INotifyPropertyChanged{public event PropertyChangedEventHandler PropertyChanged;//protected virtual void OnPropertyChanged(string propertyName)protected virtual void OnPropertyChanged([CallerMemberName] string propertyName )//此处使用特性{PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));}} }3.2在App.xaml中把它当做资源 Application x:ClassWpfApp2.Appxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:localclr-namespace:WpfApp2StartupUriMainWindow.xamlApplication.ResourcesResourceDictionarylocal:UserControl1 x:KeyucTest/local:MainViewModel x:KeyvmTest/ResourceDictionary.MergedDictionaries/ResourceDictionary.MergedDictionaries/ResourceDictionary/Application.Resources /Application3.3然后在界面中调用 Window x:ClassWpfApp2.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:WpfApp2mc:IgnorabledDataContext{StaticResource vmTest}TitleMainWindow Height450 Width800StackPanelTextBlock Text{Binding Name}/ContentControl Content{StaticResource ucTest} //StackPanel /Window3.4效果 然后可以直接绑定属性的值非常的方便不得不说这个功能很nice。 源码 https://download.csdn.net/download/u012563853/88623422 来源 巧妙的使用WPF中的资源-CSDN博客
http://www.yutouwan.com/news/476181/

相关文章:

  • 淘宝客在百度推广网站么做wordpress meta插件
  • 电商企业网站建设网站建设网站设计多少钱
  • 新余教育网站建设邢台网站建设要多少钱
  • 类似5173的网站怎么做网络信息安全网站开发教程
  • 建网站的服务器公司要做网站去哪里
  • 诛仙2官方网站西施任务怎么做校友网站建设的意义
  • 网站针对爬虫爬取做的优化上海做网站报价
  • 友链网站用wordpress修改网站
  • 网站域名做入什么科目建筑公司网站建设方案
  • 上海网站制作案例石家庄楼盘最新消息
  • 走出趣网站怎么做网站怎么做百度关键字搜索
  • 网站建设初期 该如何推广高端品牌冰箱
  • 建手机号码的网站建筑公司注册
  • 怎样注册自己网站佛山做外贸网站推广
  • 深圳网站设计公司排名热血传奇网页游戏
  • 网站开发 公司 深圳东莞最新消息今天
  • 做网站费用上海WordPress文章首页缩进
  • 买了个网站源码后要怎么用wdcp自动备份wordpress
  • 有没有便宜的网站制作上海监理建设协会网站
  • 零六年自助建设网站郑州妇科医院排行榜前十名
  • 网站做照片企业网站建设目标
  • 免费做章子的网站wordpress4.9.4 模版修改
  • 手机网站空间申请西安网页设计多少钱
  • 洛阳网站开发培训宝安建网站多少钱
  • 河北搭建营销型网站百度四川建设厅网站
  • 做全屏式网站尺寸是多大网站流量 收益
  • 贵阳建站哪个网站可以免费建站啊免费建网站
  • 企业网站虚拟空间未来最紧缺的十大专业
  • 怎么黑入网站装修房子什么风格最耐看
  • 笨笨网站建设专家网站源码后台