windows phone开发中textbox控件的header属性 - makang

栏目: 前端 · 发布时间: 8年前

内容简介:windows phone开发中textbox控件的header属性 - makang

备注;博主windows phone学习新手,在博客园上分享自己刚刚掌握的一些学习笔记,内容简单,高手勿喷!

前一段时间看@消失3003的博客,发现了textboxt的header属性。这一属性在编写UI时可以节约不少代码,十分有用。

之前编写一个如下的微信登陆界面,代码会很长;

未使用Header属性的UI及代码;

windows phone开发中textbox控件的header属性 - makang

代码如下;

<Grid>
	<TextBlock Text="登录" FontSize="20" Margin="0,15,0,600"/>
	<TextBlock Text="微信号/QQ号" FontSize="30" Margin="0,40,0,560"/>
	<TextBlock Text="账号" FontSize="20" Margin=" 20,105,0,500"/>
	<TextBox Text="微信号/手机号/QQ号" Margin=" 20,130,50,450"/>
	<TextBlock Text="密码" FontSize="20" Margin=" 20,190,50,425"/>
	<TextBox Text="请填写密码" Margin=" 20,220,50,380"/>
	<HyperlinkButton Content="忘记密码?" FontSize="20" Foreground="blue"  Margin="20,280,0,320"/>
	<HyperlinkButton Content="创建新账号" FontSize="20" Foreground="blue" Margin="20,318,0,275"/>
    </Grid>

使用header属性后的UI及代码;

windows phone开发中textbox控件的header属性 - makang

代码如下

<Grid >
	<TextBlock Text="登录" FontSize="20" Margin="0,15,0,600"/>
	<TextBlock Text="微信号/QQ号" FontSize="30" Margin="0,40,0,560"/>
	<TextBox Header="账号" Text="微信号/手机号/QQ号" Margin=" 20,130,50,430"/>
	<TextBox Header="密码" Text="请填写密码" Margin=" 20,220,50,350"/>
	<HyperlinkButton Content="忘记密码?" FontSize="20" Foreground="blue"  Margin="20,280,0,320"/>
	<HyperlinkButton Content="创建新账号" FontSize="20" Foreground="blue" Margin="20,318,0,275"/>
    </Grid>

相比之下节约了两行代码,在textbox和textblock控件比较多的情况下,header属性的优势就会更大。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Flash与后台

Flash与后台

刘明伟 / 清华大学出版社 / 2007-6 / 52.00元

《Flash与后台:ASP/ASP.NET/PHP/Java/JavaScript/Delphi总动员》从目前热门的F1ash与ASP、ASP.NET、PHP、Java、JavaScript和Delphi的交互知识入手,深入浅出地讲解了F1ash与后台通信的原理和交互的过程,力求使阅读《Flash与后台:ASP/ASP.NET/PHP/Java/JavaScript/Delphi总动员》的每一位读......一起来看看 《Flash与后台》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器