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

图片演示dw做网站百度优化是什么

图片演示dw做网站,百度优化是什么,东莞高埗疫情最新消息,如何做网站二级域名1:控件模版简介: 自定义控件模版:自己添加的样式、标签,控件模版也是属于资源的一种, 每一个控件模版都有一唯一的 key,在控件上通过template属性进行绑定 什么场景下使用自定义控件模版,当项目里面多个地方…

1:控件模版简介:

自定义控件模版:自己添加的样式、标签,控件模版也是属于资源的一种,
        每一个控件模版都有一唯一的 key,在控件上通过template属性进行绑定

什么场景下使用自定义控件模版,当项目里面多个地方使用到相同效果,这时候可以把相同
        效果封装成一个自定义模版,例如项目好几个地方需要一个弧度并且鼠标放上去效果是红色等按钮。就可以
        把按钮从新自定义一下。

2:关于控件模版的实例

<Window.Resources><!--自定义模版--><ControlTemplate x:Key="c1" TargetType="Button" ><Border Background="AliceBlue"CornerRadius="5"BorderThickness="2"x:Name="border"><!--ContentPresenter 呈现内容的标签--><StackPanel Orientation="Horizontal"><TextBlock VerticalAlignment="Center"Margin="0,0,10,0"Name="t1"Text="☆"></TextBlock><ContentPresenter HorizontalAlignment="Center"VerticalAlignment="Center"></ContentPresenter> </StackPanel></Border><!--Triggers 设置触发 鼠标移去 鼠标移开等效果--><ControlTemplate.Triggers><!--Property 设置的属性Value 属性值--><!--IsMouseOver 鼠标放上去TargetName="border" 目标元素的name属性--><Trigger Property="IsMouseOver"Value="true"><Setter Property="Background"Value="red"TargetName="border"></Setter><Setter Property="BorderBrush"Value="green"TargetName="border"></Setter><Setter Property="Text"Value="★"TargetName="t1"></Setter></Trigger></ControlTemplate.Triggers></ControlTemplate>
</Window.Resources><Grid><!--WPF不仅支持传统winfrom编程,并且还引入以模版为核心的新一代设计理念,在wpf通过使用模版将数据和界面进行解耦。模版主要分为俩大类型的模版:数据模版【DataTemplate】 和控件模版【Control Template】,控件模版:描述如何显示控件,数据模版:描述如何显示数据,--><!--<Button Width="100" Height="40" Content="hello world"></Button>--><Button Template="{StaticResource c1}" Width="100" Height="40" Content="删除" ></Button><Button Template="{StaticResource c1}"Width="100"Height="40"Content="编辑"Margin="0,0,0,100"></Button></Grid>

效果图如下

 1关于数据模板的简介:

数据模版 DataTemplate:决定了数据展示形式和用户体验,在控件上通过使用ItemTemplate
        属性进行模版的绑定  ItemTemplate="{StaticResource c1}

控件模版 ControlTemplate:设置控件展示,在控件上通过使用Template属性进行模版绑定
        Template="{StaticResource c1}

2 关于它的实例

 <Window.Resources><DataTemplate x:Key="c1"><StackPanel Orientation="Horizontal"><Border Width="10" Height="10"Background="{Binding Code}"></Border><TextBlock Text="{Binding Code}"> </TextBlock></StackPanel></DataTemplate></Window.Resources><Grid><ListBox Width="200"Height="100"HorizontalAlignment="Left"VerticalAlignment="Top"ItemTemplate="{StaticResource c1}"Name="l1"></ListBox><ComboBox Width="200"Height="40"ItemTemplate="{StaticResource c1}"Name="com"></ComboBox><!--这是之前的itemsource的写法--><ListBox Width="200"Height="100"HorizontalAlignment="Left"VerticalAlignment="Top"ItemsSource="{Binding}"Margin="300,0,0,0"Name="l3"><ListBox.ItemTemplate><DataTemplate><StackPanel Orientation="Horizontal"><Border Width="10"Height="10"Background="{Binding Code}"></Border><TextBlock Text="{Binding Code}"></TextBlock></StackPanel></DataTemplate></ListBox.ItemTemplate></ListBox></Grid>

定义模型类

    public Window数据模版(){InitializeComponent();List<Color> list = new List<Color>(); //数据源集合list.Add(new Color() { Code = "#ff0000"});list.Add(new Color(){Code = "#00ff00"});list.Add(new Color(){Code = "#00FF00"});list.Add(new Color(){Code = "#55efc4"});list.Add(new Color(){Code = "#FBCA11"});this.l1.ItemsSource = list;this.com.ItemsSource = list;//之前的数据绑定的写法this.l3.ItemsSource = list;// this.l3.DisplayMemberPath = "Code";}
}// 模型类
public class Color
{public string Code {  get; set; }//颜色的取值#FF0000
}

http://www.shuangfujiaoyu.com/news/40849.html

相关文章:

  • 常见的cms网站小广告设计
  • docker可以做网站吗整站seo外包
  • 开发运营一个app大概需要多少钱温州seo结算
  • 素材下载平台网站源码seo有哪些优化工具
  • 济南网络推广公司seo单页面优化
  • 网站动态logo怎么做推销
  • 松岗做网站哪家便宜广州网络营销选择
  • python网站搭建知名网络软文推广平台
  • 鲜花网网站开发的意义外贸平台
  • 两学一做 网站最好的网站设计公司
  • 综合性网站平台建设东莞做网络推广的公司
  • 网页设计跟网站建设百度商店
  • cc域名的网站排名seo怎么样
  • 可靠的邢台做网站引擎搜索是什么意思
  • 网站建设网站免费我的百度账号
  • 网站建设述职报告品牌推广活动方案
  • 知名的集团门户网站建设企业搜索引擎优化策略包括
  • 刷钻网站市场营销毕业论文
  • 贵阳双龙区建设局网站检测网站是否安全
  • 宁波网站建设营销推广搜索关键词站长工具
  • 专门做销售招聘网站百度网盘app下载安装官方免费下载
  • 淄博论坛网站建设百度seo关键词排名
  • 网站无障碍建设规定哈尔滨怎样关键词优化
  • 网站流量 名词苏州搜索引擎排名优化商家
  • 网站建设 北京海外自媒体推广
  • 网站建设需求方案百度爱采购官网首页
  • 网站建设费用表中国疫情最新数据
  • 怎么做qq业务网站百度账号申诉
  • 做网站 用 显示器友情链接只有链接
  • 柳城企业网站建设价格中山疫情最新消息