如何覆盖 WindowsPhone 中的 PhoneAccentBrush? [英] How to override the PhoneAccentBrush in WindowsPhone?

查看:18
本文介绍了如何覆盖 WindowsPhone 中的 PhoneAccentBrush?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上 PhoneAccentBrush 带有来自 Phone 的 SelectedTheme 强调色.但对于 WindowsPhone 应用程序中的特定 xaml 文件,我始终需要使用 BlueAccentBrush.

Basically PhoneAccentBrush comes with the SelectedTheme accent color from Phone. But i need always BlueAccentBrush for specific xaml file in the WindowsPhone application.

实际上我的要求是,当 ListPicker 处于 FullMode 时.. Popup 中的 SelectedItem 颜色取决于 PhoneAccentBrush ... 如果我将 Phone 主题设置为 Red.. 那么 Popup 中的 SelectedItem 颜色将是红色..但我不喜欢这样.. 我希望弹出窗口中的 SelectedItem 始终使用 BlueAccentBrush..

Actually my requirement is, When the ListPicker is in FullMode.. The SelectedItem color in the Popup depends upon the PhoneAccentBrush... If i set the Phone theme as Red.. then SelectedItem color in the Popup will be red.. But i dont like this.. I want always BlueAccentBrush for the SelectedItem in the Popup..

那么谁能帮我覆盖 xaml 文件中的 PhoneAccentBrush ..

So can anyone help me to override the PhoneAccentBrush in the xaml file..

推荐答案

如下添加ListPicker,

Add ListPicker as below,

<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 所选项目颜色

To override the ListPicker Selected Item Color

<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

For more Details refer the below sample: http://www.windowsphonegeek.com/upload/articles/MangoCustomApplicationTheme%20_1_2_3.zip

这篇关于如何覆盖 WindowsPhone 中的 PhoneAccentBrush?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆