I am creating a Visual Studio extension using a tool window. There I use TreeView. I want this tree view to use the current Visual Studio theme. Thanks to the message How do you allocate a TreeViewItem? I was able to set the colors of the text and the selection. But there are still questions:
- colors are updated only when the visual studio is restarted, but not immediately when I change the theme
- How to change defocused backlight colors?
- How to change the colors of expandable icons to the current colors of the theme?
- Any chance to make the backlight completely upside down, like in the solution browser window?
Here is my current XAML code:
<UserControl x:Class="DavidSpeck.CSharpDocOutline.DocOutlineView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:shell="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.12.0" Background="{DynamicResource VsBrush.Window}" Foreground="{DynamicResource VsBrush.WindowText}" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Name="MyToolWindow"> <UserControl.Resources> <Style x:Key="CETreeViewItem" TargetType="{x:Type TreeViewItem}"> <Style.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="{DynamicResource {x:Static shell:VsColors.ToolWindowTextKey}}" /> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource {x:Static shell:VsColors.HighlightKey}}" /> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="{DynamicResource {x:Static shell:VsColors.HighlightTextKey}}" /> </Style.Resources> </Style> </UserControl.Resources> <Grid> <StackPanel Orientation="Vertical"> <TreeView Name="outlineTreeView" Background="{DynamicResource VsBrush.Window}" BorderThickness="0" ItemContainerStyle="{StaticResource CETreeViewItem}"> </TreeView> </StackPanel> </Grid>
source share