-
Notifications
You must be signed in to change notification settings - Fork 40
/
FileTreeView.axaml
44 lines (39 loc) · 2.27 KB
/
FileTreeView.axaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<reactiveUi:ReactiveUserControl x:TypeArguments="singleColumn:IFileTreeViewModel"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveUi="http://reactiveui.net"
xmlns:singleColumn="clr-namespace:Examples.TreeDataGrid.SingleColumn"
xmlns:fileColumn="clr-namespace:Examples.TreeDataGrid.SingleColumn.FileColumn"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Examples.TreeDataGrid.SingleColumn.FileTreeView">
<Design.DataContext>
<singleColumn:FileTreeDesignViewModel />
</Design.DataContext>
<UserControl.Styles>
<!-- This shifts the header text to the right. -->
<!-- Note: Can't use nth-child on textblock itself. Not even actual control source does that. -->
<Style Selector="TreeDataGridColumnHeader:nth-child(1)">
<Style Selector="^ TextBlock">
<Setter Property="Margin" Value="24,0,0,0" />
</Style>
</Style>
</UserControl.Styles>
<!-- Visual Tree -->
<Grid HorizontalAlignment="Stretch">
<TreeDataGrid Classes="TreeWhiteCaret"
ShowColumnHeaders="True"
x:Name="ModFilesTreeDataGrid"
HorizontalAlignment="Stretch"
Width="1">
<!-- NOTE: we set TreeDataGrid.Width to 1 and then to double.NaN in the code behind to force a refresh of width -->
<!-- That is a workaround for TreeDataGrid star columns collapsing to 0 width. -->
<TreeDataGrid.Resources>
<DataTemplate x:Key="FileNameColumnTemplate" DataType="{x:Type fileColumn:IFileColumnViewModel}">
<fileColumn:FileColumnView DataContext="{CompiledBinding}" />
</DataTemplate>
</TreeDataGrid.Resources>
</TreeDataGrid>
</Grid>
</reactiveUi:ReactiveUserControl>