zoukankan      html  css  js  c++  java
  • windows phone开发中textbox控件的header属性

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

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

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

    代码如下;

        <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及代码;

    代码如下

    <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属性的优势就会更大。

    微博@马and康

  • 相关阅读:
    从当前url替换获得新的url
    访问者模式
    备忘录模式
    make makefile cmake qmake 区别
    qt编译过程
    tensorflow前处理
    tesorflow操作
    tensorflow的object_detection安装
    tensorflow 编译与训练
    tensorflow后处理
  • 原文地址:https://www.cnblogs.com/kangma/p/3936886.html
Copyright © 2011-2022 走看看