自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

在WP7中使用Coding4Fun Button控件

移動(dòng)開發(fā)
Coding4Fun工具包提供了RoundButton and RoundToggleButton控件,RoundToggleButton是一個(gè)UI組件,源自CheckBox控件并且暴露了一些額外的依賴屬性,正如它名字所說(shuō)的。這是一種擴(kuò)展圓形的切換按鈕且有自動(dòng)反向圖像的支持。

這篇文章將詳細(xì)討論Coding4Fun工具包中的Button控件。講解這里面的主要特性及現(xiàn)有的公共API,并給出不同情況的例子。

Coding4Fun工具包提供了RoundButton and RoundToggleButton控件,RoundToggleButton是一個(gè)UI組件,源自CheckBox控件并且暴露了一些額外的依賴屬性,正如它名字所說(shuō)的。這是一種擴(kuò)展圓形的切換按鈕且有自動(dòng)反向圖像的支持。RoundButton控件是一個(gè)圓形的且提供自動(dòng)反向圖像支持的擴(kuò)展按鈕。

RoundButton控件

在開始使用RoundButton和RoundToggleButton控件之前我們需要添加Coding4Fun.Phone.Controls.dll的引用。

你可以從這個(gè)地方下載:Coding4Fun Toolkit

首先我們需要添加“C4F”的前綴聲明,確保你的頁(yè)面聲明了“c4fToolkit” 的命名空間。

  1. xmlns:c4f="clr-namespace:Coding4Fun.Phone.Controls;assembly=Coding4Fun.Phone.Controls" 
  2. <c4f:RoundButton/> 
  3. <c4f:RoundToggleButton/> 

RoundToggleButton控件從CheckBox繼承了所有的屬性和事件,RoundButton 控件去Button控件中繼承了所有的屬性和事件。

Content屬性

這個(gè)屬性來(lái)來(lái)自父類用戶設(shè)置 RoundToggleButton/RoundButton的內(nèi)容。

ImageSource屬性

ImageSource是一個(gè)ImageSource類型的依賴屬性,它用戶設(shè)置或獲取RoundToggleButton/RoundButton控件的圖片。

Orientation屬性

Orientation是一個(gè)Orientation類型的依賴屬性,它用于設(shè)置或獲取RoundToggleButton/RoundButton控件的方向。

Examples

下面的例子我將使用2個(gè)圖標(biāo)。

Examples Examples

注:圖標(biāo)會(huì)自動(dòng)根據(jù)Light主題的變化而適當(dāng)?shù)淖兓?/p>

Example1:RoundButton示例

這個(gè)例子演示了如何設(shè)置RoundButton控件常用屬性,添加如下xaml代碼:

  1. <StackPanel Orientation="Horizontal"> 
  2. <c4f:RoundButton FontSize="18" Content="OK" BorderBrush="CornflowerBlue" /> 
  3. <c4f:RoundButton FontSize="48" Content="48" Background="CornflowerBlue" /> 
  4. <c4f:RoundButton Foreground="CornflowerBlue" FontSize="36" Content="36"/> 
  5. <c4f:RoundButton ImageSource="Images/appbar.delete.rest.png" Content="Delete"/> 
  6. </StackPanel> 

下面分別是在Dark and Light themes中的結(jié)果。

在Dark and Light  themes中的結(jié)果 在Dark and Light  themes中的結(jié)果

Example2:RoundButton Orientation and ImageSource屬性的使用

  1. <c4f:RoundButton Orientation="Horizontal" ImageSource="Images/appbar.feature.search.rest.png" Content="horizontal text"/> 

RoundButton Orientation and ImageSource 屬性 RoundButton Orientation and ImageSource 屬性

Example3. RoundToggleButton控件示例

這個(gè)例子演示了如何設(shè)置RoundToggleButton控件常用屬性,添加如下xaml代碼:

  1. <StackPanel Orientation="Horizontal"> 
  2. <c4f:RoundToggleButton FontSize="18" Content="ok" BorderBrush="CornflowerBlue" /> 
  3. <c4f:RoundToggleButton FontSize="48" Content="48" Background="CornflowerBlue" /> 
  4. <c4f:RoundToggleButton Foreground="CornflowerBlue" FontSize="36" Content="36" /> 
  5. <c4f:RoundToggleButton ImageSource="Images/appbar.delete.rest.png" Content="DELETE"/> 
  6. </StackPanel> 

RoundToggleButton控件示例 RoundToggleButton控件示例

Example4: RoundToggleButton Orientation and ImageSource屬性的使用

  1. <c4f:RoundToggleButton Orientation="Horizontal" ImageSource="Images/appbar.feature.search.rest.png" Content="horizontal text"/> 

RoundToggleButton  Orientation and ImageSource 屬性 RoundToggleButton  Orientation and ImageSource 屬性

Example5: RoundButton and RoundToggleButton控件的禁用

  1. <c4f:RoundButton x:Name="btn" IsEnabled="False" Orientation="Horizontal" ImageSource="Images/appbar.delete.rest.png" 
  2. Content="disabled button" /> 

RoundButton and RoundToggleButton控件

從Coding4fun Toolkit可以深入了解RoundButton/RoundToggleButton控件。

原文鏈接:http://www.cnblogs.com/youhui/archive/2012/03/21/2409091.html

【編輯推薦】

  1. 在WP開發(fā)中使用Coding4Fun工具包
  2. WP7開發(fā)中Coding4Fun的五種彈出框介紹
  3. 開源類庫(kù)Coding4Fun中的ToastPrompt控件介紹
  4. ToastPrompt在Windows Phone開發(fā)中的用法

 

責(zé)任編輯:王曉東 來(lái)源: cnblogs
相關(guān)推薦

2012-05-08 11:03:28

Coding4Fun

2012-05-14 10:33:43

Coding4Fun

2012-05-08 09:58:15

ToastPromptCoding4Fun

2013-06-17 12:28:00

WP7開發(fā)Windows Pho控件傾斜特效源

2013-06-17 10:31:42

WP7開發(fā)日歷控件源碼下載

2012-05-08 13:54:40

ToastPrompt

2013-06-17 14:10:08

WP7開發(fā)Windows Pho豆瓣電臺(tái)

2013-06-17 13:47:41

WP7開發(fā)Windows Pho文本框水印控件

2012-01-01 19:33:19

2011-11-25 13:52:05

Windows Pho聲音播放

2013-06-17 14:35:40

WP7Windows Pho應(yīng)用開源模板

2013-06-17 15:03:43

WP7開發(fā)騰訊微博SDK源碼下載

2013-06-17 12:44:38

WP7開發(fā)Windows Pho數(shù)獨(dú)游戲

2013-06-17 14:46:32

2013-04-12 12:36:13

WindowsPhon

2012-03-22 14:50:00

WP7微軟諾基亞

2012-05-25 12:57:31

Windows Pho

2012-05-15 14:00:51

WP7開發(fā)環(huán)境

2011-02-28 10:42:14

Windows Pho微軟

2013-06-17 14:58:23

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)