I'm using a ListBox to display a list of editable objects whose template contains, among other things, a ComboBox.
I used this common technique to hide the ListBox selection, which is not used for anything:
<ListBox.Resources>
<Style TargetType="ListBoxItem">
<Style.Resources>
<Brush x:Key="{x:Static SystemColors.HighlightBrushKey}">Transparent</Brush>
<Brush x:Key="{x:Static SystemColors.ControlBrushKey}">Transparent</Brush>
The problem is this messes with the ComboBox dropdown list selection.
I'd like to override these resources again in my template, specifying the original values (SystemColors.HighlightBrush
, etc) instead of hardcoding them. How can I do that?
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type SearchService:Criterion}">
<DataTemplate.Resources>
<!--I know how to specify a hardcoded brush here,
but not how to reference one from SystemColors-->
If you do not use the selection for anything you should just use an
ItemsControl
instead.