【问题标题】:Windows Phone Jump List With Fixed ColorWindows Phone 固定颜色跳转列表
【发布时间】:2014-04-06 00:17:11
【问题描述】:

我正在尝试为 windows phone 8 应用程序创建一个按组排序的长列表选择器,我需要修复它的颜色,以匹配应用程序的颜色主题...我能够设置背景颜色没问题,但是发生的事情是禁用的字母背景没有显示为灰色,而是显示为与启用的字母相同的颜色...这是代码:

我在做什么:

<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>

【问题讨论】:

    标签: xaml windows-phone-8 visual-studio-2013 jump-list


    【解决方案1】:

    您应该将EnabledDisabled 属性添加到JumpListItemBackgroundConverter。像这样:

    <phone:JumpListItemBackgroundConverter
        x:Key="BackgroundConverter"
        Enabled="YellowGreen"
        Disabled="DarkGreen" />
    

    如果您只想要禁用项目的标准灰色,只需省略 Disabledproperty。

    【讨论】:

      猜你喜欢
      • 2023-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-24
      • 1970-01-01
      相关资源
      最近更新 更多