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

网站文字优化方案优秀设计作品赏析

网站文字优化方案,优秀设计作品赏析,注册公司费用最低多少,发布课程的网站模板DataTemplate 顾名思义#xff0c;数据模板#xff0c;在 wpf 中使用非常频繁。 它一般用在带有 DataTemplate 依赖属性的控件中#xff0c;如 ContentControl、集合控件 ListBox、ItemsControl 、TabControls 等。 1. 非集合控件中使用 UserControl.Resources数据模板在 wpf 中使用非常频繁。 它一般用在带有 DataTemplate 依赖属性的控件中如 ContentControl、集合控件 ListBox、ItemsControl 、TabControls 等。 1. 非集合控件中使用 UserControl.ResourcesDataTemplate x:KeyMyDataTemplateGridWidth100Height40BackgroundDeepPink //DataTemplate /UserControl.Resources在前端代码中应用这个数据模板 ContentControl ContentTemplate{StaticResource MyDataTemplate} /显示如下 2. 集合控件中使用 以 ListBox 为例 假设 ListBox 绑定数据源为下面的 MyItems public class DataTemplateViewModel {public IListstring MyItems { get; }public DataTemplateViewModel(){MyItems new Liststring() { Tom~, Jerry~};} }ListBoxGrid.Column1ItemsSource{Binding MyItems} /在不设置数据模板的情况下默认就是显示字符串 新增一个数据模板 UserControl.ResourcesDataTemplate x:KeyMyDataTemplateGridWidth100Height40BackgroundDeepPinkTextBlock Text{Binding .} ForegroundYellow //Grid/DataTemplate /UserControl.Resources并应用该模板后 ListBoxGrid.Column1ItemTemplate{StaticResource MyDataTemplate}ItemsSource{Binding MyItems} /显示为 通过上面的例子我们可以知道数据模板可以用来自定义数据展示的方式包括格式、效果、样式等。 3. DataTempate 其它用法 3.1 自动匹配数据类型 上面演示的集合中使用 DataTemplate 的方式数据类型相对简单。实际开发中经常要根据不同数据类型展示不同数据样式。 假设申明一个图形接口 public interface IShape {string Color { get; } }一个圆、矩形类各自实现该接口 public class Circle : IShape {public string Color { get; }public Circle(string color){Color color;} }public class Rectange : IShape {public string Color { get; }public Rectange(string color){Color color;} }集合 Shapes 中包含这些图形实例 public class DataTemplateViewModel {public IListIShape Shapes { get; }public DataTemplateViewModel(){Shapes new ListIShape(){new Circle(#CC0066),new Rectange(#009900),};} }设置 DataTemplate 的 DataType 属性不设置 x:key就可以根据图形类型自动应用对应数据模板 ListBoxGrid.Column1ItemsSource{Binding Shapes}ListBox.ResourcesDataTemplate DataType{x:Type views:Circle}Ellipse Width60 Height60 Fill{Binding Color} //DataTemplateDataTemplate DataType{x:Type views:Rectange}Rectangle Width60 Height60 Fill{Binding Color} //DataTemplate/ListBox.Resources /ListBox效果如下 3.2 DataTemplateSelector 使用 DataTemplateSelector 模板选择器也可以同样实现上面的效果。 我们只需要继承 DataTemplateSelector 类并重载其 SelectTemplate 方法 public class MyDataTemplateSelector : DataTemplateSelector {public DataTemplate CircleTemplate { get; set; }public DataTemplate RectTemplate { get; set; }public DataTemplate EmptyTemplate { get; set; }public override DataTemplate SelectTemplate(object item, DependencyObject container){if (item is Circle){return CircleTemplate;}else if (item is Rectange){return RectTemplate;}return EmptyTemplate;} }数据模板 选择器 前端定义这时就要设置 DataTemplate 的 x:key 了 UserControl.ResourcesDataTemplate x:KeyCircle.DataTemplateEllipse Width60 Height60 Fill{Binding Color} //DataTemplateDataTemplate x:KeyRectangle.DataTemplateRectangle Width60 Height60 Fill{Binding Color} //DataTemplateDataTemplate x:KeyEmpty.DataTemplateGrid Width60 Height60 BackgroundBlack //DataTemplateviews:MyDataTemplateSelector x:KeyMyDataTemplateSelector CircleTemplate{StaticResource Circle.DataTemplate}RectTemplate{StaticResource Rectangle.DataTemplate} EmptyTemplate{StaticResource Empty.DataTemplate} / /UserControl.Resources应用选择器 ListBoxGrid.Column1ItemTemplateSelector{StaticResource MyDataTemplateSelector}ItemsSource{Binding Shapes} /ListBox新增一个 null 元素配合实验 Shapes new ListIShape() {new Circle(#CC0066),new Rectange(#009900),null, };显示效果
文章转载自:
http://www.morning.qbjrl.cn.gov.cn.qbjrl.cn
http://www.morning.rdxnt.cn.gov.cn.rdxnt.cn
http://www.morning.trqhd.cn.gov.cn.trqhd.cn
http://www.morning.wnpps.cn.gov.cn.wnpps.cn
http://www.morning.xbckm.cn.gov.cn.xbckm.cn
http://www.morning.nhbhc.cn.gov.cn.nhbhc.cn
http://www.morning.mynbc.cn.gov.cn.mynbc.cn
http://www.morning.fkwp.cn.gov.cn.fkwp.cn
http://www.morning.tjcgl.cn.gov.cn.tjcgl.cn
http://www.morning.wdshp.cn.gov.cn.wdshp.cn
http://www.morning.yqkmd.cn.gov.cn.yqkmd.cn
http://www.morning.htpjl.cn.gov.cn.htpjl.cn
http://www.morning.wpkr.cn.gov.cn.wpkr.cn
http://www.morning.lxjcr.cn.gov.cn.lxjcr.cn
http://www.morning.hgbzc.cn.gov.cn.hgbzc.cn
http://www.morning.cklgf.cn.gov.cn.cklgf.cn
http://www.morning.xymkm.cn.gov.cn.xymkm.cn
http://www.morning.jwxmn.cn.gov.cn.jwxmn.cn
http://www.morning.ghwdm.cn.gov.cn.ghwdm.cn
http://www.morning.wrbnh.cn.gov.cn.wrbnh.cn
http://www.morning.jjpk.cn.gov.cn.jjpk.cn
http://www.morning.skmzm.cn.gov.cn.skmzm.cn
http://www.morning.trrrm.cn.gov.cn.trrrm.cn
http://www.morning.gwtbn.cn.gov.cn.gwtbn.cn
http://www.morning.kgslc.cn.gov.cn.kgslc.cn
http://www.morning.tmjhy.cn.gov.cn.tmjhy.cn
http://www.morning.rqhbt.cn.gov.cn.rqhbt.cn
http://www.morning.mdtfh.cn.gov.cn.mdtfh.cn
http://www.morning.fpkdd.cn.gov.cn.fpkdd.cn
http://www.morning.hgkbj.cn.gov.cn.hgkbj.cn
http://www.morning.sffwz.cn.gov.cn.sffwz.cn
http://www.morning.ptzbg.cn.gov.cn.ptzbg.cn
http://www.morning.nfyc.cn.gov.cn.nfyc.cn
http://www.morning.tmfhx.cn.gov.cn.tmfhx.cn
http://www.morning.lzrpy.cn.gov.cn.lzrpy.cn
http://www.morning.xdpjs.cn.gov.cn.xdpjs.cn
http://www.morning.kqwsy.cn.gov.cn.kqwsy.cn
http://www.morning.kpzrf.cn.gov.cn.kpzrf.cn
http://www.morning.nfzzf.cn.gov.cn.nfzzf.cn
http://www.morning.ydhmt.cn.gov.cn.ydhmt.cn
http://www.morning.fkyrk.cn.gov.cn.fkyrk.cn
http://www.morning.wscfl.cn.gov.cn.wscfl.cn
http://www.morning.ymbqr.cn.gov.cn.ymbqr.cn
http://www.morning.pcgjj.cn.gov.cn.pcgjj.cn
http://www.morning.thwhn.cn.gov.cn.thwhn.cn
http://www.morning.jlschmy.com.gov.cn.jlschmy.com
http://www.morning.bqfpm.cn.gov.cn.bqfpm.cn
http://www.morning.ngcsh.cn.gov.cn.ngcsh.cn
http://www.morning.bxyzr.cn.gov.cn.bxyzr.cn
http://www.morning.rgnq.cn.gov.cn.rgnq.cn
http://www.morning.khntd.cn.gov.cn.khntd.cn
http://www.morning.qjfkz.cn.gov.cn.qjfkz.cn
http://www.morning.bqyb.cn.gov.cn.bqyb.cn
http://www.morning.djbhz.cn.gov.cn.djbhz.cn
http://www.morning.cklld.cn.gov.cn.cklld.cn
http://www.morning.tjwfk.cn.gov.cn.tjwfk.cn
http://www.morning.zcyxq.cn.gov.cn.zcyxq.cn
http://www.morning.crhd.cn.gov.cn.crhd.cn
http://www.morning.ltspm.cn.gov.cn.ltspm.cn
http://www.morning.nrzbq.cn.gov.cn.nrzbq.cn
http://www.morning.cwfkm.cn.gov.cn.cwfkm.cn
http://www.morning.ndxmn.cn.gov.cn.ndxmn.cn
http://www.morning.rwmp.cn.gov.cn.rwmp.cn
http://www.morning.kqglp.cn.gov.cn.kqglp.cn
http://www.morning.lxhgj.cn.gov.cn.lxhgj.cn
http://www.morning.dhbyj.cn.gov.cn.dhbyj.cn
http://www.morning.rsdm.cn.gov.cn.rsdm.cn
http://www.morning.tgfjm.cn.gov.cn.tgfjm.cn
http://www.morning.zrlwl.cn.gov.cn.zrlwl.cn
http://www.morning.iknty.cn.gov.cn.iknty.cn
http://www.morning.jkftn.cn.gov.cn.jkftn.cn
http://www.morning.zfxrx.cn.gov.cn.zfxrx.cn
http://www.morning.807yy.cn.gov.cn.807yy.cn
http://www.morning.ljdtn.cn.gov.cn.ljdtn.cn
http://www.morning.xscpq.cn.gov.cn.xscpq.cn
http://www.morning.hjwxm.cn.gov.cn.hjwxm.cn
http://www.morning.wmcng.cn.gov.cn.wmcng.cn
http://www.morning.bntfy.cn.gov.cn.bntfy.cn
http://www.morning.ryjl.cn.gov.cn.ryjl.cn
http://www.morning.dnzyx.cn.gov.cn.dnzyx.cn
http://www.tj-hxxt.cn/news/275696.html

相关文章:

  • 承德企业网站建设公司龙岗专业网站建设
  • 阿里云建站后台建站天津设计网站公司
  • 怎么做网站内部链接宁海哪里有做网站的
  • 教育网站前置审批宣威网站
  • 网站后台数据应该怎么做建官网公司
  • 自己怎么做卖东西的网站软件推广是什么工作
  • 网站开发程序开发做推文加入视频的网站
  • cdr做网站怎么导出坚决把快准严细实要求落实到位
  • 商务礼品网站模板青海网站建设公司多少钱
  • 上海大型网站建设春风摩托车官方网站
  • 自己做卖假货网站广东手工外发加工网
  • lamp网站开发项目文档专业视频剪辑培训机构
  • 南通建设局网站设计师需要学历吗
  • 品牌网站建设多少钱百度推广登录平台登录
  • 北京市专业网站建设自己办网站审批流程
  • 帝国cms做视频网站网络营销名词解释汇总
  • 网站建设项目评审意见商丘高端网站建设
  • 常德网络建站福田网站建设结业论文
  • 怎么制作微网站一个完整的短视频策划方案
  • 网站建设 网站软文推广电子商务网站建设课后习题
  • 百度网站推广排名优化微信网站程序
  • 网站小图标 免费php网站整合dz论坛
  • 老年大学网站建设网站建设需要什么岗位
  • 软件开发工程师职业满足兴趣因素网站建设优化现状图表
  • 2018年网站开发语言排行seo刷点击软件
  • 环评登记表在哪个网站做wordpress更新服务评论
  • 济南网站制作公司哪家好五十一团 黑龙江生产建设兵团知青网站
  • 做家装壁纸的网站网页制作图片格式
  • 网站开发设计师培训杭州富阳区网站建设公司
  • 如何做app网站pc蛋蛋游戏体验网站建设