I have set the theme like so where color700string is some random color:
ThemeManager.BeginUpdate();
try
{
ThemeManager.RegisterThemeDefinition(new ThemeDefinition("Custom")
{
BaseColorBlue = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(color700String)
});
ThemeManager.AreNativeThemesEnabled = true;
ThemeManager.CurrentTheme = "Custom";
}
finally
{
ThemeManager.EndUpdate();
}
I have set the style like so:
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
<Setter Property="local:FocusExtension.IsFocused" Value="{Binding IsFocused, Mode=TwoWay}"/>
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
The background selected color for TreeViewItems found in TreeViews is always the system color.
[Modified 3 years ago]