Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 51 additions & 19 deletions TypeHierarchyViewer/Views/TypeHierarchyView.xaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,60 @@
<UserControl x:Class="TypeHierarchyViewer.Views.TypeHierarchyView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:TypeHierarchyViewer.Views.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vsShell="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.14.0"
Background="{DynamicResource VsBrush.Window}"
Foreground="{DynamicResource VsBrush.WindowText}"
d:DesignHeight="300"
d:DesignWidth="300"
mc:Ignorable="d">
<UserControl
x:Class="TypeHierarchyViewer.Views.TypeHierarchyView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:TypeHierarchyViewer.Views.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vsShell="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.14.0"
xmlns:vsp="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.14.0"
d:DesignHeight="300"
d:DesignWidth="300"
Background="{DynamicResource VsBrush.Window}"
Foreground="{DynamicResource VsBrush.WindowText}"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" Text="{Binding TargetType, Converter={x:Static converters:TypeNameConverter.Instance}}" />
<TreeView Grid.Row="2" ItemsSource="{Binding TypeNodes}" ScrollViewer.VerticalScrollBarVisibility="Auto">
<TreeView
Grid.Row="2"
Background="{DynamicResource VsBrush.Window}"
BorderBrush="{DynamicResource VsBrush.Window}"
ItemsSource="{Binding TypeNodes}"
ScrollViewer.VerticalScrollBarVisibility="Auto">

<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
<Setter Property="Foreground" Value="{DynamicResource VsBrush.WindowText}" />
<Setter Property="FontWeight" Value="Normal" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{DynamicResource {x:Static vsp:TreeViewColors.SelectedItemActiveBrushKey}}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsp:TreeViewColors.SelectedItemActiveTextBrushKey}}" />
</Trigger>
<!-- Selected but not active (treeview control is not focused). -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True" />
<Condition Property="Selector.IsSelectionActive" Value="False" />
</MultiTrigger.Conditions>
<Setter Property="Background" Value="{DynamicResource {x:Static vsp:TreeViewColors.SelectedItemInactiveBrushKey}}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsp:TreeViewColors.SelectedItemInactiveTextBrushKey}}" />
</MultiTrigger>
</Style.Triggers>
</Style>
</TreeView.ItemContainerStyle>

<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Kind, Converter={x:Static converters:TypeKindToIconConverter.Instance}}" Margin="0, 0, 5, 0" />
<Image Margin="0,0,5,0" Source="{Binding Kind, Converter={x:Static converters:TypeKindToIconConverter.Instance}}" />
<TextBlock Text="{Binding Name}" />
<TextBlock Text="{Binding Namespace, StringFormat={} - ({0})}" Foreground="{x:Static SystemColors.GrayTextBrush}"/>
<TextBlock Text="{Binding Namespace, StringFormat={} - ({0})}" />
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
Expand All @@ -33,8 +65,8 @@
<EventSetter Event="MouseDoubleClick" Handler="OpenItemSymbol" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsBaseNode}" Value="True">
<Setter Property="Background" Value="{DynamicResource {x:Static vsShell:VsBrushes.InfoBackgroundKey}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsShell:VsBrushes.InfoTextKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static vsShell:VsBrushes.InfoBackgroundKey}}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsShell:VsBrushes.InfoTextKey}}" />
</DataTrigger>
</Style.Triggers>
</Style>
Expand Down