2

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

1 に答える 1

3

EnabledDisabledプロパティを に追加する必要がありますJumpListItemBackgroundConverter。そのようです:

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

無効なアイテムに標準の灰色がかった色が必要な場合は、Disabledプロパティを省略してください。

于 2014-04-23T11:49:09.007 に答える