Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 159 lines (147 sloc) 9.769 kB
2c239a4 @kaisellgren Refactoring.
authored
1 <UserControl x:Class="GG.UserControls.StatusGrid"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
a6db4c0 @kaisellgren Status panel now displays a nice status box.
authored
5 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6 xmlns:converters="clr-namespace:GG.Converters"
fd9fcfc @kaisellgren Status grid got better colors and a context menu.
authored
7 xmlns:userControls="clr-namespace:GG.UserControls"
2c239a4 @kaisellgren Refactoring.
authored
8 mc:Ignorable="d"
9 d:DesignHeight="343" d:DesignWidth="501">
a6db4c0 @kaisellgren Status panel now displays a nice status box.
authored
10 <UserControl.Resources>
11 <converters:StatusToColorConverter x:Key="statusToColorConverter" />
12 <converters:StatusToCharacterConverter x:Key="statusToCharacterConverter" />
9ec6b0a @kaisellgren Added support for display system icons next to status grid filenames.
authored
13 <converters:ExtensionToImageConverter x:Key="extensionToImageConverter" />
8d21c6b @kaisellgren Panel refactorings.
authored
14 <converters:GenericVisibilityConverter x:Key="genericVisibilityConverter" />
7926540 @kaisellgren Improved status grid context menu.
authored
15 <userControls:StatusGridContextMenu x:Key="statusGridContextMenu" />
05db008 @kaisellgren Refactored status item grids.
authored
16
17 <!-- Status template. -->
18 <ItemContainerTemplate x:Key="StatusGridStatusTemplate">
19 <WrapPanel HorizontalAlignment="Center">
20 <Border BorderThickness="0" CornerRadius="4" Background="{Binding Path=Status, Converter={StaticResource statusToColorConverter}}">
21 <TextBlock
8d21c6b @kaisellgren Panel refactorings.
authored
22 Width="16"
23 VerticalAlignment="Stretch"
24 HorizontalAlignment="Center"
25 TextAlignment="Center"
26 Foreground="White"
27 FontFamily="Arial"
28 FontSize="12"
29 FontWeight="Bold"
30 TextOptions.TextFormattingMode="Display"
31 TextOptions.TextRenderingMode="ClearType"
32 Text="{Binding Status, Converter={StaticResource statusToCharacterConverter}}" />
05db008 @kaisellgren Refactored status item grids.
authored
33 </Border>
34 </WrapPanel>
35 </ItemContainerTemplate>
fd9fcfc @kaisellgren Status grid got better colors and a context menu.
authored
36
05db008 @kaisellgren Refactored status item grids.
authored
37 <!-- Filename template. -->
38 <ItemContainerTemplate x:Key="StatusGridFilenameTemplate">
39 <WrapPanel>
40 <Image Source="{Binding Extension, Converter={StaticResource extensionToImageConverter}}" Stretch="None" Margin="0,0,3,0" />
41 <TextBlock Text="{Binding Path=Filename}"
8d21c6b @kaisellgren Panel refactorings.
authored
42 Foreground="{Binding Path=Status, Converter={StaticResource statusToColorConverter}, ConverterParameter=dark}" />
05db008 @kaisellgren Refactored status item grids.
authored
43 </WrapPanel>
44 </ItemContainerTemplate>
45
46 <!-- Grid style. -->
47 <Style TargetType="DataGrid" BasedOn="{StaticResource {x:Type DataGrid}}">
48 <Setter Property="SelectionUnit" Value="FullRow" />
49 <Setter Property="HeadersVisibility" Value="Column" />
50 <Setter Property="AutoGenerateColumns" Value="False" />
51 <Setter Property="CanUserAddRows" Value="False" />
52 <Setter Property="CanUserDeleteRows" Value="False" />
53 <Setter Property="CanUserResizeColumns" Value="True" />
54 <Setter Property="BorderThickness" Value="1,1,0,1" />
55 <Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
56 <Setter Property="VirtualizingPanel.VirtualizationMode" Value="Recycling" />
57 <Setter Property="ContextMenu" Value="{StaticResource statusGridContextMenu}" />
58 </Style>
59 </UserControl.Resources>
60
61 <Grid>
62 <Grid.RowDefinitions>
8d21c6b @kaisellgren Panel refactorings.
authored
63 <RowDefinition Height="*" MinHeight="72" />
64 <RowDefinition Height="6" />
65 <RowDefinition Height="*" MinHeight="72" />
05db008 @kaisellgren Refactored status item grids.
authored
66 </Grid.RowDefinitions>
67
8d21c6b @kaisellgren Panel refactorings.
authored
68 <userControls:Panel Grid.Row="0">
69 <userControls:Panel.Header>
70 <WrapPanel Margin="0,4,0,4">
71 <TextBlock>Staged</TextBlock>
72 <TextBlock xml:space="preserve">: </TextBlock>
73 <TextBlock Text="{Binding StatusItemsStaged.Count}" />
74 </WrapPanel>
75 </userControls:Panel.Header>
76 <userControls:Panel.Body>
77 <Grid>
78 <TextBlock Margin="8"
79 Foreground="#222"
80 Visibility="{Binding StatusItemsStaged.Count, Converter={StaticResource genericVisibilityConverter}, ConverterParameter=not}">Nothing to commit.</TextBlock>
81
82 <DataGrid
83 ItemsSource="{Binding StatusItemsStaged}"
84 SelectionChanged="StatusGridSelectionChanged"
85 BorderThickness="0"
86 Visibility="{Binding StatusItemsStaged.Count, Converter={StaticResource genericVisibilityConverter}}"
87 Tag="{Binding}">
88 <DataGrid.InputBindings>
89 <KeyBinding Command="{Binding StageUnstageCommand}"
90 CommandParameter="{Binding SelectedItems, RelativeSource={RelativeSource AncestorType=DataGrid}}"
91 Gesture="Enter" />
92 <KeyBinding Command="{Binding StageUnstageCommand}"
93 CommandParameter="{Binding SelectedItems, RelativeSource={RelativeSource AncestorType=DataGrid}}"
94 Gesture="Delete" />
95 </DataGrid.InputBindings>
05db008 @kaisellgren Refactored status item grids.
authored
96
8d21c6b @kaisellgren Panel refactorings.
authored
97 <DataGrid.Columns>
98 <DataGridTemplateColumn Header="St" CellTemplate="{StaticResource StatusGridStatusTemplate}" />
99 <DataGridTemplateColumn Header="Filename" Width="*" CellTemplate="{StaticResource StatusGridFilenameTemplate}" />
100 <DataGridTextColumn Binding="{Binding Path=Size}"
101 Header="Size"
102 Foreground="{Binding Path=Status, Converter={StaticResource statusToColorConverter}, ConverterParameter=dark}" />
103 <DataGridTextColumn Binding="{Binding Path=IsBinary}"
104 Header="Binary"
105 Foreground="{Binding Path=Status, Converter={StaticResource statusToColorConverter}, ConverterParameter=dark}" />
106 </DataGrid.Columns>
107 </DataGrid>
108 </Grid>
109 </userControls:Panel.Body>
110 </userControls:Panel>
05db008 @kaisellgren Refactored status item grids.
authored
111
8d21c6b @kaisellgren Panel refactorings.
authored
112 <GridSplitter Grid.Row="1" Style="{StaticResource GridSplitterVerticalStyle}" />
113
114 <userControls:Panel Grid.Row="2">
115 <userControls:Panel.Header>
116 <WrapPanel Margin="0,4,0,4">
117 <TextBlock>Unstaged</TextBlock>
118 <TextBlock xml:space="preserve">: </TextBlock>
119 <TextBlock Text="{Binding StatusItemsUnstaged.Count}" />
120 </WrapPanel>
121 </userControls:Panel.Header>
122 <userControls:Panel.Body>
123
124 <Grid>
125 <TextBlock Margin="8"
126 Foreground="#222"
127 Visibility="{Binding StatusItemsUnstaged.Count, Converter={StaticResource genericVisibilityConverter}, ConverterParameter=not}">Nothing to stage.</TextBlock>
128
129 <DataGrid
130 ItemsSource="{Binding StatusItemsUnstaged}"
131 SelectionChanged="StatusGridSelectionChanged"
132 BorderThickness="0"
133 Visibility="{Binding StatusItemsUnstaged.Count, Converter={StaticResource genericVisibilityConverter}}"
134 Tag="{Binding}">
135 <DataGrid.InputBindings>
136 <KeyBinding Command="{Binding StageUnstageCommand}"
137 CommandParameter="{Binding SelectedItems, RelativeSource={RelativeSource AncestorType=DataGrid}}"
138 Gesture="Enter" />
139 <KeyBinding Command="{Binding StageUnstageCommand}"
140 CommandParameter="{Binding SelectedItems, RelativeSource={RelativeSource AncestorType=DataGrid}}"
141 Gesture="Delete" />
142 </DataGrid.InputBindings>
829d44c @kaisellgren Improved status grid.
authored
143
8d21c6b @kaisellgren Panel refactorings.
authored
144 <DataGrid.Columns>
145 <DataGridTemplateColumn Header="St" CellTemplate="{StaticResource StatusGridStatusTemplate}" />
146 <DataGridTemplateColumn Header="Filename" Width="*" CellTemplate="{StaticResource StatusGridFilenameTemplate}" />
147 <DataGridTextColumn Binding="{Binding Path=Size}"
148 Header="Size"
149 Foreground="{Binding Path=Status, Converter={StaticResource statusToColorConverter}, ConverterParameter=dark}" />
150 <DataGridTextColumn Binding="{Binding Path=IsBinary}"
151 Header="Binary"
152 Foreground="{Binding Path=Status, Converter={StaticResource statusToColorConverter}, ConverterParameter=dark}" />
153 </DataGrid.Columns>
154 </DataGrid>
155 </Grid>
156 </userControls:Panel.Body>
157 </userControls:Panel>
05db008 @kaisellgren Refactored status item grids.
authored
158 </Grid>
8d21c6b @kaisellgren Panel refactorings.
authored
159 </UserControl>
Something went wrong with that request. Please try again.