मैं चयनित आइटम के लिए सूची बॉक्स पर पृष्ठभूमि रंग सेट नहीं कर सकता। मैं इस उदाहरण में वैकल्पिक रंग नहीं चाहता। मैंने उन्हें एक परीक्षण के रूप में रखा और वे काम करते हैं। ट्रिगर का चयन किया जाता है क्योंकि फ़ॉन्टवेट बोल्ड हो जाता है और अग्रभूमि लाल हो जाता है। SteelBlue पर हाइलाइट रंग ब्रश सेट करना वांछित प्रभाव प्राप्त नहीं करता है क्योंकि जब सूचीबॉक्स फोकस खो देता है तो यह दूर हो जाता है। लाल और बोल्ड तब होता है जब ListBox फोकस खो देता है और जो मैं चाहता हूं। मैं पृष्ठभूमि रंग लेना चाहता हूं और चयनित आइटम को पकड़ना चाहता हूं। अभी चयनित वस्तुओं के लिए पृष्ठभूमि सफेद है और जब सूची बॉक्स फोकस खो देता है। आपकी मदद के लिए धन्यवाद और मैं किसी प्रस्तावित फिक्स का परीक्षण करूंगा।किसी सूची बॉक्स में चयनित आइटमों के लिए पृष्ठभूमि रंग सेट करें
<ListBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="1" Name="WFEnum" Visibility="Visible" BorderThickness="2" Margin="1" Padding="2,2,7,2"
ItemsSource="{Binding Path=SearchItem.SrchWorkFlows}" HorizontalAlignment="Left"
PresentationTraceSources.TraceLevel="High" AlternationCount="2" >
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="VerticalContentAlignment" Value="Center" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="LightGreen"></Setter>
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="LightPink"></Setter>
</Trigger>
<Trigger Property="IsSelected" Value="True" >
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Background" Value="SteelBlue" />
<Setter Property="Foreground" Value="Red" />
</Trigger>
</Style.Triggers>
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
</Style.Resources>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" Background="Transparent" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
वर्थ का उल्लेख है कि 1/2015 तक, इसका मानक सिस्टम के साथ System.Windows.Controls.ListBox के चयन हाइलाइट रंगों पर कोई प्रभाव नहीं पड़ता है। ट्रिगर फोरग्राउंड के लिए काम करते हैं लेकिन पृष्ठभूमि नहीं। आपको ListBoxItem को फिर से दिखाना होगा। –