2016-09-15 5 views
0

GridviewItemのPointerOverBackgroundとSelectedPointerOverBackgroundの背景色をスタイルしたいと思います。問題は、私は選択のためのデフォルトのチェックボックスを使用すると、背景は黒/透明になり、境界線だけが見える。 Example選択チェックボックスを使用してGridViewアイテムの背景をスタイルする方法は?

<GridView x:Name="PhotostreamList" ItemContainerStyle="{StaticResource GridViewItemContainerStyle}" IsMultiSelectCheckBoxEnabled="{Binding SelectionMode}" SelectionMode="Multiple" ItemsSource="{Binding PhotoList}" SelectionChanged="PhotostreamList_SelectionChanged" HorizontalAlignment="Left" RightTapped="PhotostreamList_RightTapped" > 

私はこのために、次のスタイルを使用しています:

<Style x:Key="GridViewItemContainerStyle" TargetType="GridViewItem"> 
     <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/> 
     <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/> 
     <Setter Property="Background" Value="{ThemeResource GridViewItemBackground}"/> 
     <Setter Property="Foreground" Value="{ThemeResource GridViewItemForeground}"/> 
     <Setter Property="TabNavigation" Value="Local"/> 
     <Setter Property="IsHoldingEnabled" Value="True"/> 
     <Setter Property="HorizontalContentAlignment" Value="Center"/> 
     <Setter Property="VerticalContentAlignment" Value="Center"/> 
     <Setter Property="Margin" Value="0,0,4,4"/> 
     <Setter Property="MinWidth" Value="{ThemeResource GridViewItemMinWidth}"/> 
     <Setter Property="MinHeight" Value="{ThemeResource GridViewItemMinHeight}"/> 
     <Setter Property="AllowDrop" Value="False"/> 
     <Setter Property="UseSystemFocusVisuals" Value="True"/> 
     <Setter Property="FocusVisualMargin" Value="-2"/> 
     <Setter Property="FocusVisualPrimaryBrush" Value="{ThemeResource GridViewItemFocusVisualPrimaryBrush}"/> 
     <Setter Property="FocusVisualPrimaryThickness" Value="2"/> 
     <Setter Property="FocusVisualSecondaryBrush" Value="{ThemeResource GridViewItemFocusVisualSecondaryBrush}"/> 
     <Setter Property="FocusVisualSecondaryThickness" Value="1"/> 
     <Setter Property="Template"> 
      <Setter.Value> 
       <ControlTemplate TargetType="GridViewItem"> 
        <ListViewItemPresenter 
         CheckBrush="{ThemeResource GridViewItemCheckBrush}" 
         ContentMargin="{TemplateBinding Padding}" 
         CheckMode="{ThemeResource GridViewItemCheckMode}" 
         ContentTransitions="{TemplateBinding ContentTransitions}" 
         CheckBoxBrush="{ThemeResource GridViewItemCheckBoxBrush}" 
         DragForeground="{ThemeResource GridViewItemDragForeground}" 
         DragOpacity="{ThemeResource ListViewItemDragThemeOpacity}" 
         DragBackground="{ThemeResource GridViewItemDragBackground}" 
         DisabledOpacity="{ThemeResource ListViewItemDisabledThemeOpacity}" 
         Control.IsTemplateFocusTarget="True" 
         PointerOverForeground="{ThemeResource GridViewItemForegroundPointerOver}" 
         PressedBackground="{ThemeResource GridViewItemBackgroundPressed}" 
         PlaceholderBackground="{ThemeResource GridViewItemPlaceholderBackground}" 
         PointerOverBackground="{ThemeResource GridViewItemBackgroundPointerOver}" 
         ReorderHintOffset="{ThemeResource GridViewItemReorderHintThemeOffset}" 
         SelectedPressedBackground="{ThemeResource GridViewItemBackgroundSelectedPressed}" 
         SelectionCheckMarkVisualEnabled="{ThemeResource GridViewItemSelectionCheckMarkVisualEnabled}" 
         SelectedForeground="{ThemeResource GridViewItemForegroundSelected}" 
         SelectedPointerOverBackground="{ThemeResource GridViewItemBackgroundSelectedPointerOver}" 
         SelectedBackground="{ThemeResource GridViewItemBackgroundSelected}" 
         VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" /> 
       </ControlTemplate> 
      </Setter.Value> 
     </Setter> 
    </Style> 

何私が見つけたことは、私が「オーバーレイ」に「インライン」から「チェック・モード」に設定したときに私はこれを取得、次のとおりです。 Example

「インライン」モードで背景を埋める方法が見つからないので、どうすればこのことができますか?

答えて

0

私はからの私のプロジェクトに "GridViewItemExpanded" スタイルをコピーすることによって、私の問題を解決:

C:\プログラムファイル(x86の)\ Windowsのキット\ 10 \設計時\ CommonConfiguration \ニュートラル\ UAP \ 10.0.14393.0 \ Generic \ generic.xaml

このスタイルにはControlTemplate全体にチェックボックスが含まれていて、私はバックグラウンドを変更できました。

関連する問題