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

wordpress个人建站教程做网站用那种数据库

wordpress个人建站教程,做网站用那种数据库,阳江网站建设公司,网站的建设特色WPF文本绑定显示格式StringFormat设置 特殊格式设置日期/时间使用系统默认样式自定义格式: 绑定多个属性(多重绑定)多重绑定中的特殊字符示例: 特殊格式设置 在Textblock等文本控件中,我们经常要显示一些日期和时间&a…

WPF文本绑定显示格式StringFormat设置

  • 特殊格式设置
  • 日期/时间
    • 使用系统默认样式
    • 自定义格式:
  • 绑定多个属性(多重绑定)
    • 多重绑定中的特殊字符
    • 示例:

特殊格式设置

在Textblock等文本控件中,我们经常要显示一些日期和时间,默认显示的日期,不是我们想要的,所以需要自定义格式,还有多个数据可能需要绑定到一个文本中,都可以通过设置StringFormat来实现

日期/时间

使用系统默认样式

<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding DtNow, StringFormat={}{0:d}}" />
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding DtNow, StringFormat={}{0:D}}" />
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding DtNow, StringFormat={}{0:m}}" />
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding DtNow, StringFormat={}{0:M}}" />
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding DtNow, StringFormat={}{0:f}}" />
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding DtNow, StringFormat={}{0:F}}" />
<TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding DtNow, StringFormat={}{0:g}}" />
<TextBlock Grid.Row="7" Grid.Column="1" Text="{Binding DtNow, StringFormat={}{0:G}}" />
<TextBlock Grid.Row="8" Grid.Column="1" Text="{Binding DtNow, StringFormat={}{0:t}}" />
<TextBlock Grid.Row="9" Grid.Column="1" Text="{Binding DtNow, StringFormat={}{0:T}}" />

显示效果如下:
在这里插入图片描述

自定义格式:

<TextBox Text="{Binding DtNow, StringFormat={}{0:yyyy年MM月dd日}}" />
<TextBox Text="{Binding DtNow, StringFormat={}{0:yyyy-MM-dd}}" />
<TextBox Text="{Binding DtNow, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" />

也可以简化直接写日期格式

  <TextBlock Text="{Binding DtNow,StringFormat='yyyy年MM月dd日'}"/><TextBlock Text="{Binding DtNow,StringFormat='yyyy:MM:dd HH:mm:ss'}"/>

显示效果如下
在这里插入图片描述

绑定多个属性(多重绑定)

一个文本控件绑定多个属性合并显示,使用MultiBinding,在StringFormat中设置绑定格式{0}代表第一个属性,{1}代表第二个属性,以此类推

 <TextBlock><TextBlock.Text><MultiBinding StringFormat="数据计算:{0}/{1}={2}"><Binding Path="Value1" /><Binding Path="Value2" /><Binding Path="Result" /></MultiBinding></TextBlock.Text></TextBlock>

显示效果
在这里插入图片描述

多重绑定中的特殊字符

    \a  &#x07;  BEL\b  &#x08;  BS - Backspace\f  &#x0c;  FF - Formfeed\n  &#x0a;  LF, NL - Linefeed, New Line\r  &#x0d;  CR - Carriage return\t  &#x09;  HT - Tab\v  &#x0b;  VT - Vertical Tabelator &gt;     >(右箭头)

示例:

<TextBlock><TextBlock.Text><MultiBinding StringFormat="数据计算:{0}/{1}--&gt;{2}"><Binding Path="Value1" /><Binding Path="Value2" /><Binding Path="Result" /></MultiBinding></TextBlock.Text></TextBlock><!---->

效果
在这里插入图片描述

http://www.yayakq.cn/news/28842/

相关文章:

  • asp网站转html七牛WordPress代码
  • 库尔勒网站建设哪家专业中国建设银行网站分析
  • 图片分享网站建设网页前端框架
  • 自己做投票的网站长安东莞网站推广
  • 网站建设 十佳制作青岛公司做网站的价格
  • 厦门网站建设制作多少钱赣州热门网站
  • 网页设计 参考网站网站开发运营费用
  • 专做农产品跨境的网站有佛山做网站
  • 质控中心网站建设申请进入网站后台ftp空间后怎样上传
  • 英语门户网站织梦源码wordpress注册不成功
  • 奢侈品的网站设计wordpress 延迟加载插件
  • 汕头网站关键词优化教程建设工程教育网官网学员登录
  • 手把手教你入侵网站修改数据建筑网站建设需要注意什么
  • 一个人免费视频在线观看高清妇科医院网站优化服务商
  • 怎么自己做网站模板邯郸做网站多少钱
  • 营销网站建设制作上海公司查询官网
  • 百度做网站和推广效果怎么样网页制作工具中flash可以让网页动起来
  • 电子商务网站进度的基本流程最早的c2c网站
  • 一元云购 网站开发销售新品牌如何推广
  • intitle 律师网站建设的重要性wordpress 多说头像
  • 昆明网站优化排名推广做简历有什么网站
  • 江西建设工程招标投标网站WordPress移动端加搜索
  • 手机上免费自己做网站鞍山是哪个省哪个市
  • html怎么做网站背景福田庆三整过的网红
  • 网站 空间 租用网址大全123上网导航网址123
  • 广州 建 网站免费个人素材网站
  • 从零学php网站开发网络营销的职能有哪些
  • 邱县seo整站排名嘉兴优化网站价格
  • 淘宝网站详情页怎么做柯桥建设局网站首页
  • 海外短视频平台网站广东佛山最新通知