windows phone7 學習筆記05——主題、樣式、控制項範本

來源:互聯網
上載者:User

  Windows Phone 主題

  1. 使用者可以自己選擇主題,共有兩種背景(黑或者白),還有10中佈景主題色彩(accent colors);

  2. Silverlight控制項可以自動監測到主題,可以根據使用者的主題選擇不同的樣式。


  Windows Phone 樣式

  樣式Style基本是為特定的元素類型分配的屬性集合,除了有Key外,還有一個TargetType屬性,設定作用的控制項類型。

    <phone:PhoneApplicationPage.Resources>
<Style x:Key="BtnStyle" TargetType="Button">
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="Foreground" Value="Yellow" />
</Style>
</phone:PhoneApplicationPage.Resources>

  2. 綁定至按鈕

<Button Content="Button" Height="72" HorizontalAlignment="Left" Margin="134,137,0,0" Name="button1" VerticalAlignment="Top" Width="160" Style="{StaticResource BtnStyle}" />

  Silverlight for Windows Phone的資源字典(resource dictionary )包含了標準的樣式,使用樣式能使程式適應不同解析度的螢幕。 樣式檔案的檔案位置:系統硬碟:\Program Files\Microsoft SDKs\Windows Phone\v7.1\Design\ThemeResources.xml。

 

  Windows Phone 控制項範本

  另外一個資源字典(resource dictionary )定義SL for WP 標準控制項的模板,可以使用這些模板來定義新控制項的UI。模板檔案的位置:系統硬碟:\Program Files\Microsoft SDKs\Windows Phone\v7.1\Design\\System.Windows.xaml 。

 

  ps:在文章http://www.cnblogs.com/zjypp/archive/2012/02/05/2339321.html中有提到過資源,我沒有分清資源和樣式的區別,所以在這裡就沒有提到,如果有童鞋制動的話,麻煩在下面註明下這兩者是個什麼關係,謝謝。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.