forked from sourcegit-scm/sourcegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChangeCollectionView.axaml
More file actions
137 lines (127 loc) · 6.82 KB
/
Copy pathChangeCollectionView.axaml
File metadata and controls
137 lines (127 loc) · 6.82 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<UserControl 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:m="using:SourceGit.Models"
xmlns:v="using:SourceGit.Views"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:c="using:SourceGit.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.ChangeCollectionView"
x:Name="ThisControl">
<UserControl.Styles>
<Style Selector="ListBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ItemsPanel">
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</Setter>
</Style>
<Style Selector="ListBoxItem">
<Setter Property="Height" Value="24"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
</Style>
</UserControl.Styles>
<UserControl.DataTemplates>
<DataTemplate DataType="vm:ChangeCollectionAsTree">
<v:ChangeCollectionContainer Focusable="True"
ItemsSource="{Binding Rows}"
SelectedItems="{Binding SelectedRows, Mode=TwoWay}"
SelectionMode="Multiple"
SelectionChanged="OnRowSelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate DataType="vm:ChangeTreeNode">
<Grid ColumnDefinitions="16,16,Auto,*"
Margin="{Binding Depth, Converter={x:Static c:IntConverters.ToTreeMargin}}"
Background="Transparent"
DoubleTapped="OnRowDoubleTapped"
DataContextChanged="OnRowDataContextChanged">
<v:ChangeTreeNodeToggleButton Grid.Column="0"
Classes="tree_expander"
Focusable="False"
HorizontalAlignment="Center"
IsChecked="{Binding IsExpanded, Mode=OneWay}"
IsVisible="{Binding IsFolder}"/>
<ToggleButton Grid.Column="1"
Classes="folder"
Focusable="False"
Width="14" Height="14"
Margin="0,1,0,0"
Foreground="Goldenrod"
IsChecked="{Binding IsExpanded}"
IsVisible="{Binding IsFolder}"/>
<v:ChangeStatusIcon Grid.Column="1"
Width="14" Height="14"
IsUnstagedChange="{Binding #ThisControl.IsUnstagedChange}"
Change="{Binding Change}"
IsVisible="{Binding !IsFolder}"/>
<StackPanel Grid.Column="2" Orientation="Horizontal" Margin="4,0,0,0">
<TextBlock Text="{Binding ConflictMarker, Mode=OneWay}" Foreground="DarkOrange" FontWeight="Bold" Margin="0,0,4,0" IsVisible="{Binding ShowConflictMarker}"/>
<TextBlock Text="{Binding DisplayName, Mode=OneWay}"/>
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</v:ChangeCollectionContainer>
</DataTemplate>
<DataTemplate DataType="vm:ChangeCollectionAsGrid">
<v:ChangeCollectionContainer Focusable="True"
ItemsSource="{Binding Changes}"
SelectedItems="{Binding SelectedChanges, Mode=TwoWay}"
SelectionMode="Multiple"
SelectionChanged="OnRowSelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate DataType="m:Change">
<Grid ColumnDefinitions="Auto,Auto,Auto,*"
Background="Transparent"
DoubleTapped="OnRowDoubleTapped"
DataContextChanged="OnRowDataContextChanged">
<v:ChangeStatusIcon Grid.Column="0"
Width="14" Height="14"
Margin="4,0,0,0"
IsUnstagedChange="{Binding #ThisControl.IsUnstagedChange}"
Change="{Binding}" />
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="4,0">
<TextBlock Text="{Binding ConflictMarker}" Foreground="DarkOrange" FontWeight="Bold" Margin="0,0,4,0" IsVisible="{Binding IsConflicted}"/>
<TextBlock Text="{Binding Path, Converter={x:Static c:PathConverters.PureFileName}}"/>
</StackPanel>
<TextBlock Grid.Column="2"
Text="{Binding Path, Converter={x:Static c:PathConverters.PureDirectoryName}}"
Foreground="{DynamicResource Brush.FG2}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</v:ChangeCollectionContainer>
</DataTemplate>
<DataTemplate DataType="vm:ChangeCollectionAsList">
<v:ChangeCollectionContainer Focusable="True"
ItemsSource="{Binding Changes}"
SelectedItems="{Binding SelectedChanges, Mode=TwoWay}"
SelectionMode="Multiple"
SelectionChanged="OnRowSelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate DataType="m:Change">
<Grid ColumnDefinitions="Auto,Auto,*"
Background="Transparent"
DoubleTapped="OnRowDoubleTapped"
DataContextChanged="OnRowDataContextChanged">
<v:ChangeStatusIcon Grid.Column="0"
Width="14" Height="14"
Margin="4,0,0,0"
IsUnstagedChange="{Binding #ThisControl.IsUnstagedChange}"
Change="{Binding}" />
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="4,0">
<TextBlock Text="{Binding ConflictMarker}" Foreground="DarkOrange" FontWeight="Bold" Margin="0,0,4,0" IsVisible="{Binding IsConflicted}"/>
<TextBlock Text="{Binding Path}"/>
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</v:ChangeCollectionContainer>
</DataTemplate>
</UserControl.DataTemplates>
</UserControl>