在Silverlight中有多种按钮控件,这些控件在Windows phone7中也都得到了很好的支持。

一.Button: 这个控件只是一个基础控件,通过blend可以创建出多种效果的按钮来。

<Button Content="Button1" Height="81" HorizontalAlignment="Left" Margin="135,99,0,0" Name="button1" VerticalAlignment="Top" Width="213" Click="button1_Click"  Background="Red" Foreground="Beige" BorderBrush="Yellow" BorderThickness="5"  />

Click:响应点击的事件。

通过使用blend工具可以设置按钮的多种效果:

<Button Content="Button2" Height="81" HorizontalAlignment="Left" Margin="135,237,0,0" x:Name="button2" VerticalAlignment="Top" Width="213" Foreground="Beige" BorderBrush="Yellow" BorderThickness="5"  >

<Button.Background>

<LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">

<GradientStop Color="#FFF9F9F9" Offset="0.543"/>

<GradientStop Color="#FFF90808" Offset="0.996"/>

<GradientStop Color="Red" Offset="0.03"/>

</LinearGradientBrush>

</Button.Background>

</Button>

<Button Content="Button3" Height="81" HorizontalAlignment="Left" Margin="135,394,0,0" x:Name="button3" VerticalAlignment="Top" Width="213" Foreground="Beige" BorderBrush="Yellow" BorderThickness="5" ClickMode="Press"  >

<Button.Background>

<ImageBrush ImageSource="/Chrysanthemum.jpg" Stretch="UniformToFill"/>

</Button.Background>

</Button>

二.HyperlinkButton: 超链接按钮,这个和silverlight有明显的区别,在wp7中是不能navigate到web的。

<HyperlinkButton Content="HyperlinkButton" Height="61" HorizontalAlignment="Left" Margin="111,117,0,0" Name="hyperlinkButton1" VerticalAlignment="Top" Width="233" NavigateUri="/Windows1.xaml" >

NavigateUri:只能用Relative的链接。

三.RepeatButton: 可以在按下后,不断的发出click事件。这样就可以完成不断需要变化的需求了,如翻页、移动等。

<RepeatButton Content="RepeatButton" Height="100" HorizontalAlignment="Left" Margin="76,196,0,0" Name="repeatButton1" VerticalAlignment="Top" Width="315"  Click="repeatButton1_Click"/>

四.ToggleButton: 触发按钮,可以使按钮有二种(Checked、UnChecked)还是三种状态(多了一个Indeterminate状态)。

<ToggleButton  Content="ToggleButton" Height="182" HorizontalAlignment="Left" Margin="104,177,0,0" Name="toggleButton1" VerticalAlignment="Top" Width="268" IsThreeState="True" Checked="toggleButton1_Checked" Unchecked="toggleButton1_Unchecked"  Indeterminate="toggleButton1_Indeterminate"/>

IsThreeState:设置是否有三种状态

<Button.Content>

<Image Source="Chrysanthemum.jpg"/>

</Button.Content>

关注技术文章飞秋:http://www.freeeim.com/,24小时专业转载。

【飞秋】一起学Windows Phone7开发(十三.二 按钮控件)相关推荐

  1. 一起学Windows Phone7开发(十三.三 输入控件)

    在Phone7中主要的输入控件其实就有两个,一个是textbox,另一个就是password控件.这两个控件中尤其是TextBox控件有了很多新特性. 一.PasswordBox:   密码框控件,用 ...

  2. 【飞秋】一起学Windows Phone7开发(十三.四 基本控件)

    在这里,把一些最基本的控件列出来,其实也就是没有归类的控件都放在这里了. 一.TextBlock:这个控件其实就是Label控件. <TextBlock x:Name="PageTit ...

  3. 一起学windows phone7开发(二十二.使用系统资源)

    在windows phone7中,系统预先设置了一些资源,这样可以保证风格的一致性,在April版本时,这些资源是在创建工程时写在了App.xaml中,但到了beta版后就被隐藏了. 一.系统资源: ...

  4. Windows App开发之经常使用控件与应用栏

    控件的属性.事件与样式资源 怎样加入控件 加入控件的方式有多种,大家更喜欢以下哪一种呢? 1)使用诸如Blend for Visual Studio或Microsoft Visual Studio X ...

  5. Windows Phone7屏幕方向与常用控件

    跟林永坚老师学习wp7 屏幕方向(Orientation) 常用控件(Canvas,Grid,StackPanel,TextBlock,Image,MediaElement) 屏幕方向感应页面(Por ...

  6. 一起学Windows Phone7开发(十四.一 Phone Task)

    对于以前Windows mobile上关于SMS.Phone.Email.Camera等的开发经验都已经无效了,因为WP7根本就没有提供直接操作这些的API.但是这并不等于不能做,因为在WP7中而是可 ...

  7. 一起学windows phone7开发(二十一.二 Map控件的简单使用)

    1. 注册地图: 在使用地图之前必须先申请register key https://www.bingmapsportal.com/ 将申请到的key填到这个属性,地图才可以正常使用. Credenti ...

  8. MFC开发IM-自绘按钮控件,给按钮设置背景图片

    MFC 基础知识:对话框背景添加图片和按钮Button添加图片 很长时间没有接触MFC相关的知识了,我大概是在大二时候学习的MFC相关知识及图像处理,现在由于要帮个朋友完成个基于C++的程序,所以又回 ...

  9. Windows phone7 开发-Zune software is not launched 【转】

    刚学习Windows Phone7开发,遇到这个配置错误,在此记录一下. 错误提示:Zune软件未安装 Zune software is not installed. Install the late ...

最新文章

  1. java杀死自身并重启_java – android服务在应用程序被杀死时自动重启
  2. InstallShield使用——菜单部分
  3. 用java发送邮件(黄海已测试通过)
  4. dz自动开起html,discuz论坛开启markdown 允许html代码嵌入js
  5. ThreadLocal原理机制
  6. LLVM和clang
  7. [Swift]LeetCode862. 和至少为 K 的最短子数组 | Shortest Subarray with Sum at Least K
  8. b+树的增删改查_EF Core / 基础_从建库到增删改查
  9. vue3动态加载组件
  10. 信息泄露事件频发 快递行业的隐私面单之战
  11. 利用python进行假设假设检验
  12. 无线打印机服务器怎样设置密码,配置网络打印机服务器设置密码
  13. 2.CUDA 编程手册中文版---编程模型
  14. webp 动画 android,Android加载animated webp的控制和Glide加载GIF
  15. 路由交换技术之代理ARP
  16. Flashnbsp;AS3nbsp;学习9nbsp;-nbsp;时钟的制作
  17. 利用STM32CubeMX来设置精确到微妙(us)的定时器
  18. 微信-生成小程二维码
  19. 代理,正向代理和反向代理
  20. 软件性能测试方案怎么编写?

热门文章

  1. 二、ElasticSearch内置分词器
  2. 苏杰专访:产品创新好方向=几十年不变的需求+硬科技赋能
  3. 2021快手服饰行业数据价值报告
  4. 人工智能红利渗透与爆发
  5. python中星号数字乘字符串_Python系列-数字和字符串
  6. gson json转map_Java 中几种常用 JSON 库性能比较
  7. python剑指offer替换空格_《剑指offer》2-替换空格【Java+Python】
  8. 作者:吴东亚(1972-),女,中国电子技术标准化研究院信息技术研究中心高级工程师、副主任,国家OID注册中心副主任。...
  9. 作者:牛海波,男,中国国防科技信息中心工程师。
  10. 【计算机组成原理】微处理器、微型计算机、微型计算机系统