@ -1,9 +1,11 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tv="using:ILSpy.Controls.TreeView"
xmlns:tv="using:ILSpy.Controls.TreeView"
xmlns:ctrl="using:ILSpy.Controls"
xmlns:ilspyx="using:ICSharpCode.ILSpyX.TreeView">
xmlns:ilspyx="using:ICSharpCode.ILSpyX.TreeView">
<!-- Chevron expander: points right when collapsed, down when expanded. -->
<!-- The exact WPF SharpTreeView expander: a 9x9 white->beige gradient box whose Path is a
filled "+" when collapsed and morphs to a "-" bar when expanded (IsChecked). -->
<ControlTheme x:Key="TreeExpanderToggleTheme" TargetType="ToggleButton">
<ControlTheme x:Key="TreeExpanderToggleTheme" TargetType="ToggleButton">
<Setter Property="Width" Value="13" />
<Setter Property="Width" Value="13" />
<Setter Property="Height" Value="16" />
<Setter Property="Height" Value="16" />
@ -12,34 +14,50 @@
<Setter Property="Template">
<Setter Property="Template">
<ControlTemplate>
<ControlTemplate>
<Border Background="Transparent" Width="13" Height="16">
<Border Background="Transparent" Width="13" Height="16">
<Path Name="Chevron"
<Border Width="9" Height="9" BorderThickness="1" CornerRadius="1"
Width="5" Height="9"
BorderBrush="#FFB0B0B0"
Fill="{DynamicResource ThemeForegroundBrush}"
HorizontalAlignment="Center" VerticalAlignment="Center">
Data="M 0 0 L 4 4 L 0 8 Z"
<Border.Background>
HorizontalAlignment="Center" VerticalAlignment="Center"
<LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%">
RenderTransformOrigin="0.5,0.5" />
<GradientStop Color="White" Offset="0.2" />
<GradientStop Color="#FFC0B7A6" Offset="1" />
</LinearGradientBrush>
</Border.Background>
<Path Name="ExpandPath" Margin="1" Fill="Black"
Data="M 0 2 L 0 3 L 2 3 L 2 5 L 3 5 L 3 3 L 5 3 L 5 2 L 3 2 L 3 0 L 2 0 L 2 2 Z" />
</Border>
</Border>
</Border>
</ControlTemplate>
</ControlTemplate>
</Setter>
</Setter>
<Style Selector="^:checked /template/ Path#Chevron">
<!-- Expanded: the "+" geometry collapses to a "-" bar. -->
<Setter Property="RenderTransform" Value="rotate(90deg)" />
<Style Selector="^:checked /template/ Path#ExpandPath">
<Setter Property="Data" Value="M 0 2 L 0 3 L 5 3 L 5 2 Z" />
</Style>
</Style>
</ControlTheme>
</ControlTheme>
<!-- SharpTreeView inherits the Simple-theme ListBox chrome. -->
<!-- SharpTreeView inherits the Simple-theme ListBox chrome, but drops the theme's default
padding + border so the rows sit flush to the pane edge (no white gutter around the list). -->
<ControlTheme x:Key="{x:Type tv:SharpTreeView}" TargetType="tv:SharpTreeView"
<ControlTheme x:Key="{x:Type tv:SharpTreeView}" TargetType="tv:SharpTreeView"
BasedOn="{StaticResource {x:Type ListBox}}" />
BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="Padding" Value="0" />
<Setter Property="BorderThickness" Value="0" />
</ControlTheme>
<!-- Each row: the ListBoxItem selection chrome (from BasedOn) wraps our node content. -->
<!-- Each row: the ListBoxItem selection chrome (from BasedOn) wraps our node content. -->
<ControlTheme x:Key="{x:Type tv:SharpTreeViewItem}" TargetType="tv:SharpTreeViewItem"
<ControlTheme x:Key="{x:Type tv:SharpTreeViewItem}" TargetType="tv:SharpTreeViewItem"
BasedOn="{StaticResource {x:Type ListBoxItem}}">
BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="Padding" Value="2,0" />
<Setter Property="Padding" Value="4,0" />
<Setter Property="Margin" Value="0" />
<Setter Property="MinHeight" Value="20" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="ContentTemplate">
<Setter Property="ContentTemplate">
<DataTemplate x:CompileBindings="False">
<DataTemplate x:CompileBindings="False">
<StackPanel Orientation="Horizontal" Background="Transparent"
<Panel Background="Transparent" ToolTip.Tip="{Binding ToolTip}">
ToolTip.Tip="{Binding ToolTip}">
<!-- Classic tree connector lines, behind the content. -->
<!-- Indent spacer = Level * step. -->
<ctrl:TreeLines Node="{Binding}" Level="{Binding Level}"
IsVisible="{Binding ShowLines, RelativeSource={RelativeSource AncestorType=tv:SharpTreeView}}" />
<StackPanel Orientation="Horizontal" Height="20">
<!-- Indent spacer = (Level - 1) * step (top level sits flush left). -->
<Border Width="{Binding Level, Converter={x:Static tv:TreeIndentConverter.Instance}}" />
<Border Width="{Binding Level, Converter={x:Static tv:TreeIndentConverter.Instance}}" />
<ToggleButton Theme="{StaticResource TreeExpanderToggleTheme}"
<ToggleButton Theme="{StaticResource TreeExpanderToggleTheme}"
VerticalAlignment="Center"
VerticalAlignment="Center"
@ -48,21 +66,14 @@
<!-- Reserve the expander column even when there is no expander. -->
<!-- Reserve the expander column even when there is no expander. -->
<Border Width="13" IsVisible="{Binding !ShowExpander}" />
<Border Width="13" IsVisible="{Binding !ShowExpander}" />
<Image Source="{Binding Icon}" Width="16" Height="16"
<Image Source="{Binding Icon}" Width="16" Height="16"
Margin="0,0,4 ,0" VerticalAlignment="Center" />
Margin="4,0,6 ,0" VerticalAlignment="Center" />
<TextBlock Text="{Binding Text}" VerticalAlignment="Center"
<TextBlock Text="{Binding Text}" VerticalAlignment="Center"
Classes.autoloaded="{Binding IsAutoLoaded}"
Classes.autoloaded="{Binding IsAutoLoaded}"
Classes.nonPublicAPI="{Binding IsNonPublicAPI}" />
Classes.nonPublicAPI="{Binding IsNonPublicAPI}" />
</StackPanel>
</StackPanel>
</Panel>
</DataTemplate>
</DataTemplate>
</Setter>
</Setter>
<!-- Dim auto-loaded assemblies / non-public API, but never let the dim colour bleed
through a selected row's highlight (mirrors the old DataGridRow:not(:selected) rule). -->
<Style Selector="^:not(:selected) TextBlock.autoloaded">
<Setter Property="Foreground" Value="{DynamicResource ILSpy.TreeAutoloadedForeground}" />
</Style>
<Style Selector="^:not(:selected) TextBlock.nonPublicAPI">
<Setter Property="Foreground" Value="{DynamicResource ILSpy.TreeNonPublicForeground}" />
</Style>
</ControlTheme>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>