-
Notifications
You must be signed in to change notification settings - Fork 386
Expand file tree
/
Copy pathChangeCollectionView.axaml
More file actions
149 lines (136 loc) · 6.97 KB
/
ChangeCollectionView.axaml
File metadata and controls
149 lines (136 loc) · 6.97 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
138
139
140
141
142
143
144
145
146
147
148
149
<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">
<StackPanel Orientation="Horizontal"
Height="24"
Margin="{Binding Depth, Converter={x:Static c:IntConverters.ToTreeMargin}}"
Background="Transparent"
DoubleTapped="OnRowDoubleTapped"
DataContextChanged="OnRowDataContextChanged">
<Border Width="16">
<v:ChangeTreeNodeToggleButton Classes="tree_expander"
Focusable="False"
HorizontalAlignment="Center"
IsChecked="{Binding IsExpanded, Mode=OneWay}"
IsVisible="{Binding IsFolder}"/>
</Border>
<ToggleButton Classes="folder"
Focusable="False"
Width="14" Height="14"
Margin="1,1,1,0"
Foreground="Goldenrod"
IsChecked="{Binding IsExpanded}"
IsVisible="{Binding IsFolder}"/>
<v:ChangeStatusIcon Width="14" Height="14"
Margin="1,0"
IsUnstagedChange="{Binding #ThisControl.IsUnstagedChange}"
Change="{Binding Change}"
IsVisible="{Binding !IsFolder}"/>
<TextBlock Text="{Binding ConflictMarker, Mode=OneWay}"
Foreground="DarkOrange"
FontWeight="Bold"
Margin="4,0,0,0"
IsVisible="{Binding ShowConflictMarker}"/>
<TextBlock Text="{Binding DisplayName, Mode=OneWay}"
Margin="4,0,0,0"/>
</StackPanel>
</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">
<StackPanel Orientation="Horizontal"
Height="24"
Background="Transparent"
DoubleTapped="OnRowDoubleTapped"
DataContextChanged="OnRowDataContextChanged">
<v:ChangeStatusIcon Width="14" Height="14"
Margin="4,0,0,0"
IsUnstagedChange="{Binding #ThisControl.IsUnstagedChange}"
Change="{Binding}" />
<TextBlock Text="{Binding ConflictMarker}"
Foreground="DarkOrange"
FontWeight="Bold"
Margin="4,0,0,0" IsVisible="{Binding IsConflicted}"/>
<TextBlock Text="{Binding Path, Converter={x:Static c:PathConverters.PureFileName}}"
Margin="4,0,0,0"/>
<TextBlock Text="{Binding Path, Converter={x:Static c:PathConverters.PureDirectoryName}}"
Foreground="{DynamicResource Brush.FG2}"
Margin="4,0,0,0"/>
</StackPanel>
</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">
<StackPanel Orientation="Horizontal"
Height="24"
Background="Transparent"
DoubleTapped="OnRowDoubleTapped"
DataContextChanged="OnRowDataContextChanged">
<v:ChangeStatusIcon Width="14" Height="14"
Margin="4,0,0,0"
IsUnstagedChange="{Binding #ThisControl.IsUnstagedChange}"
Change="{Binding}" />
<TextBlock Text="{Binding ConflictMarker}"
Foreground="DarkOrange"
FontWeight="Bold"
Margin="4,0,0,0"
IsVisible="{Binding IsConflicted}"/>
<TextBlock Margin="4,0,0,0"
Text="{Binding Path}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</v:ChangeCollectionContainer>
</DataTemplate>
</UserControl.DataTemplates>
</UserControl>