I have a treeview and I set the background of the items with a multivalue converter, so I would like to set transparent the default selection color to show the color that I set in the multivalueconverter.
I am trying this:
<Treeview Name="mytreeView"><TreeView.Resources><HierarchicalDataTemplate DataType="{x:Type ViewModels:MynodeViewModel}" ItemsSource="{Binding Path=Childrens}"><StackPanel Orientation="Horizontal"></TextBlock><TextBlock Text="{Binding Path=Node.Property1}" /><TextBlock Text=" ("/><TextBlock Text="{Binding Path=Node.Property2}"/><TextBlock Text=")"/></StackPanel></HierarchicalDataTemplate><SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" /><SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" /><SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="Transparent" /><SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="Black" /></TreeView.Resources><TreeView.ItemContainerStyle><Style TargetType="{x:Type TreeViewItem}"><Setter Property="Behaviors:TreeViewItemBehavior.IsBroughtIntoViewWhenSelected" Value="True" /><Setter Property="IsExpanded" Value="{Binding IsExpanded, NotifyOnSourceUpdated=True}" /><Setter Property="IsSelected" Value="{Binding IsSelected, NotifyOnSourceUpdated=True}" /><Setter Property="FontWeight" Value="Normal"/><Setter Property="Background"><Setter.Value><MultiBinding Converter="{StaticResource myMultiValueConverter}"><MultiBinding.Bindings><Binding /><Binding ElementName="ucPrincipal" Path="DataContext.MyProperty1"/><Binding ElementName="ucPrincipal" Path="DataContext.MyProperty2"/></MultiBinding.Bindings></MultiBinding></Setter.Value></Setter><Style.Triggers><Trigger Property="IsSelected" Value="True"><Setter Property="FontWeight" Value="Bold" /></Trigger></Style.Triggers><Style.Resources><SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/><SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black"/><SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="Transparent"/><SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="Black"/><SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/></Style.Resources></Style></TreeView.ItemContainerStyle></Treeview>
How it is shown, I have tried to set transparent "HighlightBrushKey" and "InactiveSelectionHighlightBrushKey", in the resources of the tree view and in the resources of the ItemContainerStyle, but the result is the same, when I select
an item, the color that I set in my multivalue converter is hidden by the default color of the selected item.
How can I set transparent the color of the selected item to show the color of my multivalue converter?
Thank so much.