I am currently working on a WPF application which is to be deployed on both Windows 7 and 10. In the app there is a custom Combo Box control:
<utils:FilteredComboBox
Height="28"
Background="#222222"
FontSize="14"
Foreground="White"
IsEditable="True"
IsEnabled="{Binding ElementsEnabled}"
IsTextSearchEnabled="False"
ItemsSource="{Binding Path=FlatItemSource, Mode=OneWay}"
SelectedItem="{Binding SelectedFlatItem}"
StaysOpenOnEdit="True">
<utils:FilteredComboBox.Style>
<Style>
<Setter Property="FrameworkElement.OverridesDefaultStyle" Value="False" />
</Style>
</utils:FilteredComboBox.Style>
<utils:FilteredComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel VirtualizationMode="Recycling" />
</ItemsPanelTemplate>
</utils:FilteredComboBox.ItemsPanel>
<utils:FilteredComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<TextBlock Style="{StaticResource CardValue}" Text="{Binding Name}" />
<TextBlock
FontSize="10"
Foreground="White"
Text="{Binding Comments}" />
</StackPanel>
</DataTemplate>
</utils:FilteredComboBox.ItemTemplate>
</utils:FilteredComboBox>
On Windows 7 it appears normally having the dark gray background both in the TextBox part and in the Dropdown list, as can be seen on screen below.
But on Windows 10 the TextBox part becomes White while the dropdown list remains dark gray. Making any changes to the background property doesn't affect the control, but for example changing the Foreground makes text a different color. There are other combo boxes on the same screen which keep the proper coloring (they are normal combo boxes, not custom one like this one).
How can I fix this? I've tried creating a custom template for the control, but upon trying to Edit a copy of the template, VS (2015) returns an error that copying the template has failed.
Code for the Card Value style that's used in dropdown:
<Style x:Key="CardValue"
TargetType="TextBlock">
<Setter
Property="FontSize"
Value="14" />
<Setter
Property="FontFamily"
Value="Segoe UI" />
<Setter
Property="Foreground"
Value="White" />
</Style>