Xaml 具有固定颜色的Windows Phone跳转列表
我正在尝试为windows phone 8应用程序创建一个组排序的长列表选择器,我需要它的颜色被固定,以匹配应用程序的颜色主题。。。我可以毫无问题地设置背景色,但实际情况是,禁用的字母背景不会显示为灰色,而是以与启用字母相同的颜色显示。。。代码如下: 我在做什么:Xaml 具有固定颜色的Windows Phone跳转列表,xaml,windows-phone-8,visual-studio-2013,jump-list,Xaml,Windows Phone 8,Visual Studio 2013,Jump List,我正在尝试为windows phone 8应用程序创建一个组排序的长列表选择器,我需要它的颜色被固定,以匹配应用程序的颜色主题。。。我可以毫无问题地设置背景色,但实际情况是,禁用的字母背景不会显示为灰色,而是以与启用字母相同的颜色显示。。。代码如下: 我在做什么: <phone:JumpListItemForegroundConverter x:Key="ForegroundConverter"/> <Style x:Key="AddrBookJumpListStyle" Ta
<phone:JumpListItemForegroundConverter x:Key="ForegroundConverter"/>
<Style x:Key="AddrBookJumpListStyle" TargetType="phone:LongListSelector">
<Setter Property="GridCellSize" Value="113,113"/>
<Setter Property="LayoutMode" Value="Grid" />
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<Border **Background="#FF00a3e8"** Width="113" Height="113" Margin="6" >
<TextBlock Text="{Binding Key}" FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="48" Padding="6"
Foreground="{Binding Converter={StaticResource ForegroundConverter}}" VerticalAlignment="Center"/>
</Border>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
什么会将禁用的项目显示为灰色,但会将背景颜色绑定到手机主题:
<phone:JumpListItemBackgroundConverter x:Key="BackgroundConverter"/>
<phone:JumpListItemForegroundConverter x:Key="ForegroundConverter"/>
<Style x:Key="AddrBookJumpListStyle" TargetType="phone:LongListSelector">
<Setter Property="GridCellSize" Value="113,113"/>
<Setter Property="LayoutMode" Value="Grid" />
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<Border **Background="{Binding Converter={StaticResource BackgroundConverter}}"** Width="113" Height="113" Margin="6" >
<TextBlock Text="{Binding Key}" FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="48" Padding="6"
Foreground="{Binding Converter={StaticResource ForegroundConverter}}" VerticalAlignment="Center"/>
</Border>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
您应该将
已启用
和已禁用
属性添加到JumpListItemBackgroundConverter
。像这样:
<phone:JumpListItemBackgroundConverter
x:Key="BackgroundConverter"
Enabled="YellowGreen"
Disabled="DarkGreen" />
如果您只希望禁用的项目使用标准的灰色,只需省略disabled
属性即可