|
3 | 3 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
4 | 4 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
5 | 5 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 6 | + xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" |
6 | 7 | xmlns:local="clr-namespace:Workshop.Control" |
7 | 8 | mc:Ignorable="d" |
8 | 9 | d:DesignHeight="450" d:DesignWidth="800" |
9 | 10 | DataContext="{Binding Source={StaticResource Locator},Path=SyntaxTreeViewer}"> |
| 11 | + <UserControl.Resources> |
| 12 | + <Style x:Key="TreeViewStyle" TargetType="TreeViewItem"> |
| 13 | + <Setter Property="IsSelected" Value="{Binding IsExpanded, Mode=TwoWay}"/> |
| 14 | + </Style> |
| 15 | + </UserControl.Resources> |
10 | 16 |
|
11 | 17 | <Grid> |
12 | | - <Grid.RowDefinitions> |
13 | | - <RowDefinition Height="Auto"></RowDefinition> |
14 | | - <RowDefinition Height="*"></RowDefinition> |
15 | | - </Grid.RowDefinitions> |
16 | | - <StackPanel> |
17 | | - <TextBlock ></TextBlock> |
18 | | - <TextBlock ></TextBlock> |
19 | | - </StackPanel> |
20 | | - <TreeView Grid.Row="1" ItemsSource="{Binding RootItems}"> |
| 18 | + <Grid.ColumnDefinitions> |
| 19 | + <ColumnDefinition Width="2*"></ColumnDefinition> |
| 20 | + <ColumnDefinition></ColumnDefinition> |
| 21 | + </Grid.ColumnDefinitions> |
| 22 | + |
| 23 | + <TreeView Grid.Column="0" |
| 24 | + SelectedItemChanged="TreeView_SelectedItemChanged" |
| 25 | + ItemsSource="{Binding RootItems}" |
| 26 | + ItemContainerStyle="{StaticResource TreeViewStyle}"> |
21 | 27 | <TreeView.ItemTemplate> |
22 | | - <HierarchicalDataTemplate |
| 28 | + <HierarchicalDataTemplate |
| 29 | + |
23 | 30 | ItemsSource="{Binding Items}"> |
24 | | - <TextBlock Text="{Binding Header}" ></TextBlock> |
| 31 | + <TextBlock Foreground="{Binding Background}" Text="{Binding Header}" ToolTip="{Binding ToolTip}"></TextBlock> |
25 | 32 | </HierarchicalDataTemplate> |
26 | 33 | </TreeView.ItemTemplate> |
27 | 34 | </TreeView> |
| 35 | + <StackPanel Grid.Column="1"> |
| 36 | + <local:SimpleKeyValueControl KeyText="Kind" |
| 37 | + ValueText="{Binding Kind}"></local:SimpleKeyValueControl> |
| 38 | + <local:SimpleKeyValueControl KeyText="Type" |
| 39 | + ValueText="{Binding Type}"></local:SimpleKeyValueControl> |
| 40 | + |
| 41 | + </StackPanel> |
28 | 42 | </Grid> |
29 | 43 | </UserControl> |
0 commit comments