Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 7926540a6a
Fetching contributors…

Cannot retrieve contributors at this time

116 lines (110 sloc) 6.862 kb
<UserControl x:Class="GG.UserControls.StatusGrid"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:converters="clr-namespace:GG.Converters"
xmlns:userControls="clr-namespace:GG.UserControls"
mc:Ignorable="d"
d:DesignHeight="343" d:DesignWidth="501">
<UserControl.Resources>
<converters:StatusToColorConverter x:Key="statusToColorConverter" />
<converters:StatusToCharacterConverter x:Key="statusToCharacterConverter" />
<converters:ExtensionToImageConverter x:Key="extensionToImageConverter" />
<userControls:StatusGridContextMenu x:Key="statusGridContextMenu" />
</UserControl.Resources>
<DockPanel>
<DataGrid SelectionUnit="FullRow"
HeadersVisibility="Column"
ItemsSource="{Binding StatusItemsGrouped}"
AutoGenerateColumns="False"
BorderThickness="1,1,0,1"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserResizeColumns="True"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.VirtualizationMode="Recycling"
ContextMenu="{StaticResource statusGridContextMenu}"
Tag="{Binding}"
x:Name="StatusGridElement">
<DataGrid.InputBindings>
<KeyBinding Command="{Binding StageUnstageCommand}" Gesture="Enter" />
<KeyBinding Command="{Binding StageUnstageCommand}" Gesture="Delete" />
</DataGrid.InputBindings>
<DataGrid.Columns>
<DataGridTemplateColumn Header="St">
<DataGridTemplateColumn.CellTemplate>
<ItemContainerTemplate>
<WrapPanel HorizontalAlignment="Center">
<Border BorderThickness="0" CornerRadius="4" Background="{Binding Path=Status, Converter={StaticResource statusToColorConverter}}">
<TextBlock
Width="16"
VerticalAlignment="Stretch"
HorizontalAlignment="Center"
TextAlignment="Center"
Foreground="White"
FontFamily="Arial"
FontSize="12"
FontWeight="Bold"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="ClearType"
Text="{Binding Status, Converter={StaticResource statusToCharacterConverter}}" />
</Border>
</WrapPanel>
</ItemContainerTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Filename" Width="*">
<DataGridTemplateColumn.CellTemplate>
<ItemContainerTemplate>
<WrapPanel>
<Image Source="{Binding Extension, Converter={StaticResource extensionToImageConverter}}" Stretch="None" Margin="0,0,3,0" />
<TextBlock Text="{Binding Path=Filename}"
Foreground="{Binding Path=Status, Converter={StaticResource statusToColorConverter}, ConverterParameter=dark}" />
</WrapPanel>
</ItemContainerTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding Path=Size}"
Header="Size"
Foreground="{Binding Path=Status, Converter={StaticResource statusToColorConverter}, ConverterParameter=dark}" />
<DataGridTextColumn Binding="{Binding Path=IsBinary}"
Header="Binary"
Foreground="{Binding Path=Status, Converter={StaticResource statusToColorConverter}, ConverterParameter=dark}" />
</DataGrid.Columns>
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<StackPanel>
<Border BorderBrush="#aaa" BorderThickness="0,1,0,1">
<Grid Style="{DynamicResource DataGridGroupItemStyle}">
<StackPanel Orientation="Horizontal" Margin="4,3,0,3">
<TextBlock Text="{Binding Name}" />
<TextBlock xml:space="preserve">: </TextBlock>
<TextBlock Text="{Binding ItemCount}"/>
</StackPanel>
</Grid>
</Border>
<ItemsPresenter />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
</DataGrid>
</DockPanel>
</UserControl>
Jump to Line
Something went wrong with that request. Please try again.