In realtà un modo migliore per scoprire le proprietà dello stile è utilizzare Blend.
Innanzitutto, apri la pagina in Blend. Quindi fare clic destro sul tuo ListView
e andare
Modifica modelli aggiuntivi> Modifica elemento generato Container (ItemContainerStyle)> Modifica copia.
Assegnare un nome e premere OK.
Ora avete generato lo stile completo integrato per il vostro ListViewItem
s ed è qui che potete trovare tutte le informazioni sul loro aspetto, animazioni e altri comportamenti visivi.
Si dovrebbe essere guardare a questo pezzo di codice -
<ListViewItemPresenter CheckBrush="{ThemeResource SystemControlForegroundBaseMediumHighBrush}"
ContentMargin="{TemplateBinding Padding}"
CheckMode="Inline"
ContentTransitions="{TemplateBinding ContentTransitions}"
CheckBoxBrush="{ThemeResource SystemControlForegroundBaseMediumHighBrush}"
DragForeground="{ThemeResource ListViewItemDragForegroundThemeBrush}"
DragOpacity="{ThemeResource ListViewItemDragThemeOpacity}"
DragBackground="{ThemeResource ListViewItemDragBackgroundThemeBrush}"
DisabledOpacity="{ThemeResource ListViewItemDisabledThemeOpacity}"
FocusBorderBrush="{ThemeResource SystemControlForegroundAltHighBrush}"
FocusSecondaryBorderBrush="{ThemeResource SystemControlForegroundBaseHighBrush}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
PointerOverForeground="{ThemeResource SystemControlHighlightAltBaseHighBrush}"
PressedBackground="{ThemeResource SystemControlHighlightListMediumBrush}"
PlaceholderBackground="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}"
PointerOverBackground="{ThemeResource SystemControlHighlightListLowBrush}"
ReorderHintOffset="{ThemeResource ListViewItemReorderHintThemeOffset}"
SelectedPressedBackground="{ThemeResource SystemControlHighlightListAccentHighBrush}"
SelectionCheckMarkVisualEnabled="True"
SelectedForeground="{ThemeResource SystemControlHighlightAltBaseHighBrush}"
SelectedPointerOverBackground="{ThemeResource SystemControlHighlightListAccentMediumBrush}"
SelectedBackground="{ThemeResource SystemControlHighlightListAccentLowBrush}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
vedere la linea SelectedBackground="{ThemeResource SystemControlHighlightListAccentLowBrush}"
? È lì che puoi applicare il tuo colore. Tieni presente che dovrebbe essere di tipo Brush
anziché Color
.
fonte
2015-08-31 00:12:59
Grazie! È proprio quello di cui avevo bisogno. – alecardv