windows phone (27) 基础Button

Button 在wp7中因其灵活性经常会用到,我们在ContentPanel中直接添加Button,button默认状态下是把整个gridview填充完全,比如代码这样的代码

<!--ContentPanel - 在此处放置其他内容-->
        <Grid x:Name= " ContentPanel " Grid.Row= " 1 " Margin= " 12,0,12,0 ">
            <Button Content= " 点击我 " BorderBrush= " Red " BorderThickness= " 10 "></Button>
            
        </Grid>

 其呈现效果


从上面的图片我们可以看出button显示的文字是textblock,边缘是border,所以我们还可以继续给button添加一些属性,比如字体,背景色,等等一些textblock和border的属性

 <!--ContentPanel - 在此处放置其他内容-->
        <Grid x:Name= " ContentPanel " Grid.Row= " 1 " Margin= " 12,0,12,0 ">
            <Button Content= " 点击我 " BorderBrush= " DarkGoldenrod "
                    BorderThickness= " 10 " FontSize= " 50 " FontFamily= " Portable User Interface "
                    FontStyle= " Italic " Foreground= " Navy "
                    >
                 
            </Button>
            
        </Grid>

 

 

<!--ContentPanel - 在此处放置其他内容-->
        <Grid x:Name= " ContentPanel " Grid.Row= " 1 " Margin= " 12,0,12,0 ">
            <Button Content= " 点击我 " BorderBrush= " DarkGoldenrod "
                    BorderThickness= " 10 " FontSize= " 50 " FontFamily= " Portable User Interface "
                    FontStyle= " Italic " Foreground= " Navy " Width= " 300 " Height= " 200 " Padding= " 50 10 " Margin= " 12,0,12,0 " ClickMode= " Press "
                    >
                 
            </Button>
            
        </Grid>

 

 

 clickMode属性

 

Release
      指定当按下并松开鼠标左键且鼠标指针位于控件上方时应引发,如果使用的是键盘,则指定在按下并松开空格键或 Enter 键且控件具有键盘焦点时应引发
Press
      指定在按下鼠标按键且鼠标指针位于控件上方时应引发, 如果使用的是键盘,则指定在按下空格键或 Enter 且控件具有键盘焦点时应引发 Click 事件(话说这个比较适合于广告)
Hover
      指定当鼠标指针在控件上移动时应引发 Click 事件。

 

Content

 

System.Object
   System.Windows.DependencyObject
     System.Windows.UIElement
       System.Windows.FrameworkElement
         System.Windows.Controls.Control
          System.Windows.Controls .ContentControl
 

 凡是继承此类的元素都可以具有content属性

 


 

 由于PC的项目,已经两三个月没有更新wp的文章了,群里每天都在讨论win 8,wp8 眼馋那

转载于:https://www.cnblogs.com/shenzhoulong/archive/2012/09/13/2592530.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值