, Sie nicht SystemColors.ControlTextBrushKey
Leider verwenden können, weil es gilt, wenn das Element nicht ausgewählt ist, oder wenn es aktiviert ist, aber inaktiv (Ihre Frage lautet, als ob Sie sind nur daran interessiert, im letzteren). Allerdings können Sie dies tun:
<ListBox ...>
<ListBox.Resources>
<!-- this customizes the background color when the item is selected but inactive -->
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}">Red</SolidColorBrush>
</ListBox.Resources>
<ListBox.ItemContainerStyle>
<Style>
<Style.Triggers>
<!-- this customizes the foreground color when the item is selected but inactive -->
<Trigger Property="Selector.IsSelected" Value="True">
<Setter Property="TextElement.Foreground" Value="Blue"/>
</Trigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
Danke für Sie zu beantworten, aber leider ausgewähltes Element wird grau, wenn ListBox verliert Fokus :( ich weiß zu sein und Hintergrund blau Vordergrund würde, wenn das Element ausgewählt ist, aber inaktiv. –
meine Antwort aktualisiert. –