2012-06-19 10 views
1

基本上PhoneAccentBrush帶有來自Phone的SelectedTheme口音顏色。但我總是需要在WindowsPhone應用程序中使用BlueAccentBrush來獲取特定的xaml文件。如何覆蓋WindowsPhone中的PhoneAccentBrush?

實際上,我的要求是,當ListPicker處於FullMode中時。Popup中的SelectedItem顏色取決於PhoneAccentBrush ...如果將Phone主題設置爲Red ..則Popup中的SelectedItem顏色將爲紅色。但我不喜歡這樣。我想總是BlueAccentBrush在彈出的SelectedItem ..

因此,誰能幫我重寫PhoneAccentBrush在XAML文件..

回答

2

添加ListPicker如下,

<StackPanel x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0" >  
<toolkit:ListPicker ListPickerMode="Full"> 
<toolkit:ListPickerItem Content="Item1"/> 
<toolkit:ListPickerItem Content="Item1"/> 
<toolkit:ListPickerItem Content="Item2"/> 
<toolkit:ListPickerItem Content="Item3"/> 
<toolkit:ListPickerItem Content="Item4"/> 
</toolkit:ListPicker> 
</StackPanel> 

要覆蓋ListPicker所選項目顏色

<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:System="clr-namespace:System;assembly=mscorlib"> 
    <Color x:Key="PhoneAccentColor">Blue</Color> 

    <SolidColorBrush x:Key="PhoneAccentBrush" Color="{StaticResource PhoneAccentColor}"/> 
    <Style x:Key="PhoneTextAccentStyle" TargetType="TextBlock" BasedOn="{StaticResource PhoneTextBlockBase}"> 
     <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> 
     <Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/> 
    </Style> 
</ResourceDictionary> 

欲瞭解更多詳情請參考下面的示例:http://www.windowsphonegeek.com/upload/articles/MangoCustomApplicationTheme%20_1_2_3.zip

+0

良好的嘗試... –