enhance: using lightweight ListBox instead of DataGrid to improve performance

This commit is contained in:
leo 2024-08-27 21:28:48 +08:00
parent 1f07c1bdf0
commit 7776cda475
No known key found for this signature in database
12 changed files with 465 additions and 529 deletions

View file

@ -275,7 +275,7 @@ namespace SourceGit.Models
unsolved.Remove(l); unsolved.Remove(l);
} }
// Margins & merge state (used by datagrid). // Margins & merge state (used by Views.Histories).
commit.IsMerged = isMerged; commit.IsMerged = isMerged;
commit.Margin = new Thickness(Math.Max(offsetX + HALF_WIDTH, oldCount * UNIT_WIDTH + H_MARGIN) + H_MARGIN, 0, 0, 0); commit.Margin = new Thickness(Math.Max(offsetX + HALF_WIDTH, oldCount * UNIT_WIDTH + H_MARGIN) + H_MARGIN, 0, 0, 0);

View file

@ -309,7 +309,11 @@ namespace SourceGit.ViewModels
public Models.Commit SearchResultSelectedCommit public Models.Commit SearchResultSelectedCommit
{ {
get => _searchResultSelectedCommit; get => _searchResultSelectedCommit;
set => SetProperty(ref _searchResultSelectedCommit, value); set
{
if (SetProperty(ref _searchResultSelectedCommit, value) && value != null)
NavigateToCommit(value.SHA);
}
} }
public void Open() public void Open()

View file

@ -53,44 +53,42 @@
<!-- Unchanged Files --> <!-- Unchanged Files -->
<Grid Grid.Row="1"> <Grid Grid.Row="1">
<DataGrid Margin="8" <ListBox Margin="8"
Background="{DynamicResource Brush.Contents}" BorderThickness="1"
ItemsSource="{Binding Files}" BorderBrush="{DynamicResource Brush.Border2}"
SelectionMode="Single" Background="{DynamicResource Brush.Contents}"
CanUserReorderColumns="False" SelectionMode="Single"
CanUserResizeColumns="False" ItemsSource="{Binding Files}"
CanUserSortColumns="False" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
IsReadOnly="True" ScrollViewer.VerticalScrollBarVisibility="Auto">
HeadersVisibility="None" <ListBox.Styles>
Focusable="False" <Style Selector="ListBoxItem">
RowHeight="26" <Setter Property="Margin" Value="0"/>
BorderThickness="1" <Setter Property="Padding" Value="0"/>
BorderBrush="{DynamicResource Brush.Border2}" <Setter Property="Height" Value="26"/>
HorizontalScrollBarVisibility="Disabled" </Style>
VerticalScrollBarVisibility="Auto"> </ListBox.Styles>
<DataGrid.Columns>
<DataGridTemplateColumn Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Margin="8,0,4,0" Data="{StaticResource Icons.File}"/>
<TextBlock Text="{Binding}" Margin="4,0"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn> <ListBox.ItemsPanel>
<DataGridTemplateColumn.CellTemplate> <ItemsPanelTemplate>
<DataTemplate> <VirtualizingStackPanel Orientation="Vertical"/>
<Button Classes="icon_button" Click="OnRemoveButtonClicked"> </ItemsPanelTemplate>
<Path Width="14" Height="14" Data="{StaticResource Icons.Clear}"/> </ListBox.ItemsPanel>
</Button>
</DataTemplate> <ListBox.ItemTemplate>
</DataGridTemplateColumn.CellTemplate> <DataTemplate>
</DataGridTemplateColumn> <Grid Height="26" ColumnDefinitions="26,*,30">
</DataGrid.Columns> <Path Grid.Column="0" Width="14" Height="14" Margin="8,0,0,0" HorizontalAlignment="Center" Data="{StaticResource Icons.File}"/>
</DataGrid> <Border Grid.Column="1" Margin="4,0" ClipToBounds="True">
<TextBlock Grid.Column="1" Text="{Binding}" HorizontalAlignment="Left"/>
</Border>
<Button Grid.Column="2" Classes="icon_button" Click="OnRemoveButtonClicked">
<Path Width="14" Height="14" Data="{StaticResource Icons.Clear}"/>
</Button>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!-- Empty --> <!-- Empty -->
<StackPanel Orientation="Vertical" <StackPanel Orientation="Vertical"

View file

@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:m="using:SourceGit.Models"
xmlns:vm="using:SourceGit.ViewModels" xmlns:vm="using:SourceGit.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.DeleteMultipleBranches" x:Class="SourceGit.Views.DeleteMultipleBranches"
@ -17,56 +18,37 @@
BorderBrush="{DynamicResource Brush.Border1}" BorderBrush="{DynamicResource Brush.Border1}"
CornerRadius="4" CornerRadius="4"
Padding="4"> Padding="4">
<DataGrid MaxHeight="200" <ListBox MaxHeight="200"
Background="Transparent" BorderThickness="0"
BorderThickness="0" Background="Transparent"
ItemsSource="{Binding Targets}" ItemsSource="{Binding Targets}"
SelectionMode="Single" SelectionMode="Single"
CanUserReorderColumns="False" ScrollViewer.HorizontalScrollBarVisibility="Auto"
CanUserResizeColumns="False" ScrollViewer.VerticalScrollBarVisibility="Auto">
CanUserSortColumns="False" <ListBox.Styles>
IsReadOnly="True" <Style Selector="ListBoxItem">
HeadersVisibility="None" <Setter Property="Margin" Value="0"/>
Focusable="False" <Setter Property="Padding" Value="0"/>
RowHeight="26" <Setter Property="Height" Value="26"/>
HorizontalScrollBarVisibility="Auto" <Setter Property="CornerRadius" Value="4"/>
VerticalScrollBarVisibility="Auto">
<DataGrid.Styles>
<Style Selector="DataGridRow">
<Setter Property="CornerRadius" Value="4" />
</Style> </Style>
</ListBox.Styles>
<Style Selector="DataGridRow /template/ Border#RowBorder"> <ListBox.ItemsPanel>
<Setter Property="ClipToBounds" Value="True" /> <ItemsPanelTemplate>
</Style> <VirtualizingStackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<Style Selector="DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle"> <ListBox.ItemTemplate>
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" /> <DataTemplate DataType="m:Branch">
</Style> <Grid Height="26" ColumnDefinitions="22,*">
<Path Grid.Column="0" Width="10" Height="10" Margin="4,0,8,0" Data="{StaticResource Icons.Branch}" />
<Style Selector="DataGridRow:selected /template/ Rectangle#BackgroundRectangle"> <TextBlock Grid.Column="1" Text="{Binding FriendlyName}" Classes="primary" />
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" /> </Grid>
</Style> </DataTemplate>
</DataGrid.Styles> </ListBox.ItemTemplate>
</ListBox>
<DataGrid.Columns>
<DataGridTemplateColumn Header="ICON">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Path Width="10" Height="10" Margin="4,0,8,0" Data="{StaticResource Icons.Branch}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="NAME">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding FriendlyName}" ClipToBounds="True" Classes="primary" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Border> </Border>
<TextBlock Margin="4,8,0,0" <TextBlock Margin="4,8,0,0"

View file

@ -53,51 +53,54 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<DataGrid Grid.Column="0" <ListBox Grid.Column="0"
Background="{DynamicResource Brush.Contents}" Background="{DynamicResource Brush.Contents}"
BorderThickness="1" BorderThickness="1"
Margin="8,4,4,8" Margin="8,4,4,8"
BorderBrush="{DynamicResource Brush.Border2}" BorderBrush="{DynamicResource Brush.Border2}"
ItemsSource="{Binding Commits}" ItemsSource="{Binding Commits}"
SelectedItem="{Binding SelectedCommit, Mode=TwoWay}" SelectedItem="{Binding SelectedCommit, Mode=TwoWay}"
SelectionMode="Single" SelectionMode="Single"
CanUserReorderColumns="False" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
CanUserResizeColumns="False" ScrollViewer.VerticalScrollBarVisibility="Auto">
CanUserSortColumns="False" <ListBox.Styles>
IsReadOnly="True" <Style Selector="ListBoxItem">
HeadersVisibility="None" <Setter Property="Margin" Value="0"/>
Focusable="False" <Setter Property="Padding" Value="0"/>
RowHeight="50" <Setter Property="Height" Value="50"/>
HorizontalScrollBarVisibility="Disabled" </Style>
VerticalScrollBarVisibility="Auto"> </ListBox.Styles>
<DataGrid.Columns>
<DataGridTemplateColumn Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="m:Commit">
<Border BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="0,0,0,1" Padding="4">
<Grid RowDefinitions="Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto,Auto">
<v:Avatar Grid.Column="0" Width="16" Height="16" VerticalAlignment="Center" IsHitTestVisible="False" User="{Binding Author}"/>
<TextBlock Grid.Column="1" Classes="primary" Text="{Binding Author.Name}" Margin="8,0,0,0"/>
<TextBlock Grid.Column="2"
Classes="primary"
Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"
Background="Transparent"
Foreground="DarkOrange"
TextDecorations="Underline"
Margin="8,0,0,0"
PointerPressed="OnPressCommitSHA"/>
<TextBlock Grid.Column="3" Classes="primary" Text="{Binding AuthorTimeShortStr}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
</Grid>
<TextBlock Grid.Row="1" Classes="primary" Text="{Binding Subject}" VerticalAlignment="Bottom"/> <ListBox.ItemsPanel>
</Grid> <ItemsPanelTemplate>
</Border> <VirtualizingStackPanel Orientation="Vertical"/>
</DataTemplate> </ItemsPanelTemplate>
</DataGridTemplateColumn.CellTemplate> </ListBox.ItemsPanel>
</DataGridTemplateColumn>
</DataGrid.Columns> <ListBox.ItemTemplate>
</DataGrid> <DataTemplate DataType="m:Commit">
<Border BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="0,0,0,1" Padding="4">
<Grid RowDefinitions="Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto,Auto">
<v:Avatar Grid.Column="0" Width="16" Height="16" VerticalAlignment="Center" IsHitTestVisible="False" User="{Binding Author}"/>
<TextBlock Grid.Column="1" Classes="primary" Text="{Binding Author.Name}" Margin="8,0,0,0" ClipToBounds="True"/>
<TextBlock Grid.Column="2"
Classes="primary"
Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"
Background="Transparent"
Foreground="DarkOrange"
TextDecorations="Underline"
Margin="8,0,0,0"
PointerPressed="OnPressCommitSHA"/>
<TextBlock Grid.Column="3" Classes="primary" Text="{Binding AuthorTimeShortStr}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
</Grid>
<TextBlock Grid.Row="1" Classes="primary" Text="{Binding Subject}" VerticalAlignment="Bottom"/>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<GridSplitter Grid.Column="1" <GridSplitter Grid.Column="1"
MinWidth="1" MinWidth="1"

View file

@ -66,203 +66,172 @@
<!-- Body --> <!-- Body -->
<Border Grid.Row="2" Margin="8,0,8,8" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"> <Border Grid.Row="2" Margin="8,0,8,8" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
<Grid RowDefinitions="*,3,*"> <Grid RowDefinitions="*,3,*">
<DataGrid Grid.Row="0" <ListBox Grid.Row="0"
Background="{DynamicResource Brush.Contents}" Background="{DynamicResource Brush.Contents}"
ItemsSource="{Binding Items}" ItemsSource="{Binding Items}"
SelectionMode="Single" SelectionMode="Single"
SelectedItem="{Binding SelectedItem, Mode=OneWayToSource}" SelectedItem="{Binding SelectedItem, Mode=OneWayToSource}"
CanUserReorderColumns="False" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
CanUserResizeColumns="False" ScrollViewer.VerticalScrollBarVisibility="Auto"
CanUserSortColumns="False" KeyDown="OnItemsListBoxKeyDown">
IsReadOnly="True" <ListBox.Styles>
HeadersVisibility="None" <Style Selector="ListBoxItem">
Focusable="False" <Setter Property="Margin" Value="0"/>
RowHeight="28" <Setter Property="Padding" Value="0"/>
HorizontalScrollBarVisibility="Disabled" <Setter Property="Height" Value="28"/>
VerticalScrollBarVisibility="Auto" </Style>
KeyDown="OnDataGridKeyDown"> </ListBox.Styles>
<DataGrid.Columns>
<DataGridTemplateColumn Width="16" Header="DragHandler">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="{x:Type vm:InteractiveRebaseItem}">
<Border Background="Transparent"
Margin="4,0,0,0"
Loaded="OnSetupRowHeaderDragDrop"
PointerPressed="OnRowHeaderPointerPressed">
<Path Width="14" Height="14" Data="{StaticResource Icons.Move}" Fill="{DynamicResource Brush.FG2}"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Option"> <ListBox.ItemsPanel>
<DataGridTemplateColumn.CellTemplate> <ItemsPanelTemplate>
<DataTemplate x:DataType="{x:Type vm:InteractiveRebaseItem}"> <VirtualizingStackPanel Orientation="Vertical"/>
<Button Opacity="1" Margin="4,0,0,0" Padding="8,2" Background="Transparent"> </ItemsPanelTemplate>
<Button.Flyout> </ListBox.ItemsPanel>
<MenuFlyout Placement="BottomEdgeAlignedLeft" VerticalOffset="-4">
<MenuItem InputGesture="P" Command="{Binding SetAction}" CommandParameter="{x:Static m:InteractiveRebaseAction.Pick}">
<MenuItem.Icon>
<Ellipse Width="14" Height="14" Fill="Green"/>
</MenuItem.Icon>
<MenuItem.Header>
<Grid ColumnDefinitions="64,240">
<TextBlock Grid.Column="0" Classes="primary" Margin="4,0" Text="Pick"/>
<TextBlock Grid.Column="1" Text="Use this commit" Foreground="{DynamicResource Brush.FG2}"/>
</Grid>
</MenuItem.Header>
</MenuItem>
<MenuItem InputGesture="E" Command="{Binding SetAction}" CommandParameter="{x:Static m:InteractiveRebaseAction.Edit}"> <ListBox.ItemTemplate>
<MenuItem.Icon> <DataTemplate DataType="vm:InteractiveRebaseItem">
<Ellipse Width="14" Height="14" Fill="Orange"/> <Grid ColumnDefinitions="16,110,*,40,100,96,156,32,32">
</MenuItem.Icon> <!-- Drag & Drop Anchor -->
<MenuItem.Header> <Border Grid.Column="0" Background="Transparent"
<Grid ColumnDefinitions="64,240"> Margin="4,0,0,0"
<TextBlock Grid.Column="0" Classes="primary" Margin="4,0" Text="Edit"/> Loaded="OnSetupRowHeaderDragDrop"
<TextBlock Grid.Column="1" Text="Stop for amending" Foreground="{DynamicResource Brush.FG2}"/> PointerPressed="OnRowHeaderPointerPressed">
</Grid> <Path Width="14" Height="14" Data="{StaticResource Icons.Move}" Fill="{DynamicResource Brush.FG2}"/>
</MenuItem.Header> </Border>
</MenuItem>
<MenuItem InputGesture="R" Command="{Binding SetAction}" CommandParameter="{x:Static m:InteractiveRebaseAction.Reword}"> <!-- Action -->
<MenuItem.Icon> <Button Grid.Column="1" Opacity="1" Margin="4,0,0,0" Padding="8,2" Background="Transparent">
<Ellipse Width="14" Height="14" Fill="Orange"/> <Button.Flyout>
</MenuItem.Icon> <MenuFlyout Placement="BottomEdgeAlignedLeft" VerticalOffset="-4">
<MenuItem.Header> <MenuItem InputGesture="P" Command="{Binding SetAction}" CommandParameter="{x:Static m:InteractiveRebaseAction.Pick}">
<Grid ColumnDefinitions="64,240"> <MenuItem.Icon>
<TextBlock Grid.Column="0" Classes="primary" Margin="4,0" Text="Reword"/> <Ellipse Width="14" Height="14" Fill="Green"/>
<TextBlock Grid.Column="1" Text="Edit the commit message" Foreground="{DynamicResource Brush.FG2}"/> </MenuItem.Icon>
</Grid> <MenuItem.Header>
</MenuItem.Header> <Grid ColumnDefinitions="64,240">
</MenuItem> <TextBlock Grid.Column="0" Classes="primary" Margin="4,0" Text="Pick"/>
<TextBlock Grid.Column="1" Text="Use this commit" Foreground="{DynamicResource Brush.FG2}"/>
</Grid>
</MenuItem.Header>
</MenuItem>
<MenuItem InputGesture="S" Command="{Binding SetAction}" CommandParameter="{x:Static m:InteractiveRebaseAction.Squash}"> <MenuItem InputGesture="E" Command="{Binding SetAction}" CommandParameter="{x:Static m:InteractiveRebaseAction.Edit}">
<MenuItem.Icon> <MenuItem.Icon>
<Ellipse Width="14" Height="14" Fill="LightGray"/> <Ellipse Width="14" Height="14" Fill="Orange"/>
</MenuItem.Icon> </MenuItem.Icon>
<MenuItem.Header> <MenuItem.Header>
<Grid ColumnDefinitions="64,240"> <Grid ColumnDefinitions="64,240">
<TextBlock Grid.Column="0" Classes="primary" Margin="4,0" Text="Squash"/> <TextBlock Grid.Column="0" Classes="primary" Margin="4,0" Text="Edit"/>
<TextBlock Grid.Column="1" Text="Meld into previous commit" Foreground="{DynamicResource Brush.FG2}"/> <TextBlock Grid.Column="1" Text="Stop for amending" Foreground="{DynamicResource Brush.FG2}"/>
</Grid> </Grid>
</MenuItem.Header> </MenuItem.Header>
</MenuItem> </MenuItem>
<MenuItem InputGesture="F" Command="{Binding SetAction}" CommandParameter="{x:Static m:InteractiveRebaseAction.Fixup}"> <MenuItem InputGesture="R" Command="{Binding SetAction}" CommandParameter="{x:Static m:InteractiveRebaseAction.Reword}">
<MenuItem.Icon> <MenuItem.Icon>
<Ellipse Width="14" Height="14" Fill="LightGray"/> <Ellipse Width="14" Height="14" Fill="Orange"/>
</MenuItem.Icon> </MenuItem.Icon>
<MenuItem.Header> <MenuItem.Header>
<Grid ColumnDefinitions="64,240"> <Grid ColumnDefinitions="64,240">
<TextBlock Grid.Column="0" Classes="primary" Margin="4,0" Text="Fixup"/> <TextBlock Grid.Column="0" Classes="primary" Margin="4,0" Text="Reword"/>
<TextBlock Grid.Column="1" Text="Like 'Squash' but discard message" Foreground="{DynamicResource Brush.FG2}"/> <TextBlock Grid.Column="1" Text="Edit the commit message" Foreground="{DynamicResource Brush.FG2}"/>
</Grid> </Grid>
</MenuItem.Header> </MenuItem.Header>
</MenuItem> </MenuItem>
<MenuItem InputGesture="D" Command="{Binding SetAction}" CommandParameter="{x:Static m:InteractiveRebaseAction.Drop}"> <MenuItem InputGesture="S" Command="{Binding SetAction}" CommandParameter="{x:Static m:InteractiveRebaseAction.Squash}">
<MenuItem.Icon> <MenuItem.Icon>
<Ellipse Width="14" Height="14" Fill="Red"/> <Ellipse Width="14" Height="14" Fill="LightGray"/>
</MenuItem.Icon> </MenuItem.Icon>
<MenuItem.Header> <MenuItem.Header>
<Grid ColumnDefinitions="64,240"> <Grid ColumnDefinitions="64,240">
<TextBlock Grid.Column="0" Classes="primary" Margin="4,0" Text="Drop"/> <TextBlock Grid.Column="0" Classes="primary" Margin="4,0" Text="Squash"/>
<TextBlock Grid.Column="1" Text="Remove commit" Foreground="{DynamicResource Brush.FG2}"/> <TextBlock Grid.Column="1" Text="Meld into previous commit" Foreground="{DynamicResource Brush.FG2}"/>
</Grid> </Grid>
</MenuItem.Header> </MenuItem.Header>
</MenuItem> </MenuItem>
</MenuFlyout>
</Button.Flyout>
<StackPanel Orientation="Horizontal"> <MenuItem InputGesture="F" Command="{Binding SetAction}" CommandParameter="{x:Static m:InteractiveRebaseAction.Fixup}">
<Ellipse Width="14" Height="14" Fill="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.ToIconBrush}}"/> <MenuItem.Icon>
<TextBlock Classes="primary" Margin="8,0" Text="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.ToName}}"/> <Ellipse Width="14" Height="14" Fill="LightGray"/>
</StackPanel> </MenuItem.Icon>
</Button> <MenuItem.Header>
</DataTemplate> <Grid ColumnDefinitions="64,240">
</DataGridTemplateColumn.CellTemplate> <TextBlock Grid.Column="0" Classes="primary" Margin="4,0" Text="Fixup"/>
</DataGridTemplateColumn> <TextBlock Grid.Column="1" Text="Like 'Squash' but discard message" Foreground="{DynamicResource Brush.FG2}"/>
</Grid>
</MenuItem.Header>
</MenuItem>
<MenuItem InputGesture="D" Command="{Binding SetAction}" CommandParameter="{x:Static m:InteractiveRebaseAction.Drop}">
<MenuItem.Icon>
<Ellipse Width="14" Height="14" Fill="Red"/>
</MenuItem.Icon>
<MenuItem.Header>
<Grid ColumnDefinitions="64,240">
<TextBlock Grid.Column="0" Classes="primary" Margin="4,0" Text="Drop"/>
<TextBlock Grid.Column="1" Text="Remove commit" Foreground="{DynamicResource Brush.FG2}"/>
</Grid>
</MenuItem.Header>
</MenuItem>
</MenuFlyout>
</Button.Flyout>
<DataGridTemplateColumn Width="*" Header="SUBJECT">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="{x:Type vm:InteractiveRebaseItem}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Button Classes="icon_button" IsVisible="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.CanEditMessage}}"> <Ellipse Width="14" Height="14" Fill="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.ToIconBrush}}"/>
<Button.Flyout> <TextBlock Classes="primary" Margin="8,0" Text="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.ToName}}"/>
<Flyout Placement="BottomEdgeAlignedLeft">
<Panel Width="600" Height="120">
<v:CommitMessageTextBox Text="{Binding FullMessage, Mode=TwoWay}"/>
</Panel>
</Flyout>
</Button.Flyout>
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Edit}"/>
</Button>
<TextBlock Classes="primary" Text="{Binding Subject}" Margin="8,0,0,0"/>
</StackPanel> </StackPanel>
</DataTemplate> </Button>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="AVATAR"> <!-- Subject -->
<DataGridTemplateColumn.CellTemplate> <StackPanel Grid.Column="2" Orientation="Horizontal" ClipToBounds="True">
<DataTemplate x:DataType="{x:Type vm:InteractiveRebaseItem}"> <Button Classes="icon_button" IsVisible="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.CanEditMessage}}">
<v:Avatar Width="16" Height="16" <Button.Flyout>
Margin="16,0,8,0" <Flyout Placement="BottomEdgeAlignedLeft">
VerticalAlignment="Center" <Panel Width="600" Height="120">
IsHitTestVisible="False" <v:CommitMessageTextBox Text="{Binding FullMessage, Mode=TwoWay}"/>
User="{Binding Commit.Author}"/> </Panel>
</DataTemplate> </Flyout>
</DataGridTemplateColumn.CellTemplate> </Button.Flyout>
</DataGridTemplateColumn> <Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Edit}"/>
<DataGridTemplateColumn MaxWidth="100" Header="AUTHOR">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="{x:Type vm:InteractiveRebaseItem}">
<TextBlock Classes="primary" Text="{Binding Commit.Author.Name}" Margin="0,0,8,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="SHA">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="{x:Type vm:InteractiveRebaseItem}">
<TextBlock Classes="primary"
Text="{Binding Commit.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"
Margin="12,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="TIME">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="{x:Type vm:InteractiveRebaseItem}">
<TextBlock Classes="primary" Text="{Binding Commit.CommitterTimeStr}" Margin="8,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="32" Header="MOVE UP">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="{x:Type vm:InteractiveRebaseItem}">
<Button Classes="icon_button" Click="OnMoveItemUp" ToolTip.Tip="{DynamicResource Text.InteractiveRebase.MoveUp}">
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Up}"/>
</Button> </Button>
</DataTemplate> <TextBlock Classes="primary" Text="{Binding Subject}" Margin="8,0,0,0"/>
</DataGridTemplateColumn.CellTemplate> </StackPanel>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="32" Header="MOVE DOWN"> <!-- Avatar -->
<DataGridTemplateColumn.CellTemplate> <v:Avatar Grid.Column="3"
<DataTemplate x:DataType="{x:Type vm:InteractiveRebaseItem}"> Width="16" Height="16"
<Button Classes="icon_button" Click="OnMoveItemDown" ToolTip.Tip="{DynamicResource Text.InteractiveRebase.MoveDown}"> Margin="16,0,8,0"
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Down}"/> VerticalAlignment="Center"
</Button> IsHitTestVisible="False"
</DataTemplate> User="{Binding Commit.Author}"/>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> <!-- Author -->
</DataGrid.Columns> <Border Grid.Column="4" ClipToBounds="True">
</DataGrid> <TextBlock Classes="primary" Text="{Binding Commit.Author.Name}" HorizontalAlignment="Left"/>
</Border>
<!-- Commit SHA -->
<TextBlock Grid.Column="5" Classes="primary"
Text="{Binding Commit.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"
Margin="12,0"/>
<!-- Commit Time -->
<TextBlock Grid.Column="6" Classes="primary" Text="{Binding Commit.CommitterTimeStr}" Margin="8,0"/>
<!-- MoveUp Button -->
<Button Grid.Column="7" Classes="icon_button" Click="OnMoveItemUp" ToolTip.Tip="{DynamicResource Text.InteractiveRebase.MoveUp}">
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Up}"/>
</Button>
<!-- MoveDown Button -->
<Button Grid.Column="8" Classes="icon_button" Click="OnMoveItemDown" ToolTip.Tip="{DynamicResource Text.InteractiveRebase.MoveDown}">
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Down}"/>
</Button>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<v:LoadingIcon Grid.Row="0" Width="48" Height="48" HorizontalAlignment="Center" VerticalAlignment="Center" IsVisible="{Binding IsLoading}"/> <v:LoadingIcon Grid.Row="0" Width="48" Height="48" HorizontalAlignment="Center" VerticalAlignment="Center" IsVisible="{Binding IsLoading}"/>

View file

@ -88,9 +88,9 @@ namespace SourceGit.Views
} }
} }
private void OnDataGridKeyDown(object sender, KeyEventArgs e) private void OnItemsListBoxKeyDown(object sender, KeyEventArgs e)
{ {
var item = (sender as DataGrid)?.SelectedItem as ViewModels.InteractiveRebaseItem; var item = (sender as ListBox)?.SelectedItem as ViewModels.InteractiveRebaseItem;
if (item == null) if (item == null)
return; return;

View file

@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:m="using:SourceGit.Models"
xmlns:vm="using:SourceGit.ViewModels" xmlns:vm="using:SourceGit.ViewModels"
xmlns:v="using:SourceGit.Views" xmlns:v="using:SourceGit.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
@ -51,62 +52,48 @@
<!-- Locked Files --> <!-- Locked Files -->
<Grid Grid.Row="1"> <Grid Grid.Row="1">
<DataGrid Margin="8" <ListBox Margin="8"
Background="{DynamicResource Brush.Contents}" Background="{DynamicResource Brush.Contents}"
ItemsSource="{Binding Locks}" ItemsSource="{Binding Locks}"
SelectionMode="Single" SelectionMode="Single"
CanUserReorderColumns="False" BorderThickness="1"
CanUserResizeColumns="False" BorderBrush="{DynamicResource Brush.Border2}"
CanUserSortColumns="False" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
IsReadOnly="True" ScrollViewer.VerticalScrollBarVisibility="Auto">
HeadersVisibility="None" <ListBox.Styles>
Focusable="False" <Style Selector="ListBoxItem">
RowHeight="26" <Setter Property="Margin" Value="0"/>
BorderThickness="1" <Setter Property="Padding" Value="0"/>
BorderBrush="{DynamicResource Brush.Border2}" <Setter Property="Height" Value="26"/>
HorizontalScrollBarVisibility="Disabled" </Style>
VerticalScrollBarVisibility="Auto"> </ListBox.Styles>
<DataGrid.Columns>
<DataGridTemplateColumn Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Margin="8,0,4,0" Data="{StaticResource Icons.File}"/>
<TextBlock Text="{Binding File}" Margin="4,0"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn> <ListBox.ItemsPanel>
<DataGridTemplateColumn.CellTemplate> <ItemsPanelTemplate>
<DataTemplate> <VirtualizingStackPanel Orientation="Vertical"/>
<TextBlock Text="{Binding User}" Padding="16,0"/> </ItemsPanelTemplate>
</DataTemplate> </ListBox.ItemsPanel>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn> <ListBox.ItemTemplate>
<DataGridTemplateColumn.CellTemplate> <DataTemplate DataType="m:LFSLock">
<DataTemplate> <Grid ColumnDefinitions="26,*,100,32,32">
<Button Classes="icon_button" Click="OnUnlockButtonClicked" ToolTip.Tip="{DynamicResource Text.GitLFS.Locks.Unlock}"> <Path Grid.Column="0" Width="14" Height="14" Margin="8,0,4,0" Data="{StaticResource Icons.File}"/>
<Path Width="14" Height="14" Data="{StaticResource Icons.Unlock}"/> <Border Grid.Column="1" Margin="4,0" ClipToBounds="True">
</Button> <TextBlock Text="{Binding File}" HorizontalAlignment="Left"/>
</DataTemplate> </Border>
</DataGridTemplateColumn.CellTemplate> <Border Grid.Column="2" Margin="8,0" ClipToBounds="True">
</DataGridTemplateColumn> <TextBlock Text="{Binding User}" HorizontalAlignment="Left"/>
</Border>
<DataGridTemplateColumn> <Button Grid.Column="3" Classes="icon_button" Click="OnUnlockButtonClicked" ToolTip.Tip="{DynamicResource Text.GitLFS.Locks.Unlock}">
<DataGridTemplateColumn.CellTemplate> <Path Width="14" Height="14" Data="{StaticResource Icons.Unlock}"/>
<DataTemplate> </Button>
<Button Classes="icon_button" Click="OnForceUnlockButtonClicked" ToolTip.Tip="{DynamicResource Text.GitLFS.Locks.UnlockForce}"> <Button Grid.Column="4" Classes="icon_button" Click="OnForceUnlockButtonClicked" ToolTip.Tip="{DynamicResource Text.GitLFS.Locks.UnlockForce}">
<Path Width="14" Height="14" Fill="Red" Data="{StaticResource Icons.Unlock}"/> <Path Width="14" Height="14" Fill="Red" Data="{StaticResource Icons.Unlock}"/>
</Button> </Button>
</DataTemplate> </Grid>
</DataGridTemplateColumn.CellTemplate> </DataTemplate>
</DataGridTemplateColumn> </ListBox.ItemTemplate>
</DataGrid.Columns> </ListBox>
</DataGrid>
<!-- Empty --> <!-- Empty -->
<StackPanel Orientation="Vertical" <StackPanel Orientation="Vertical"

View file

@ -257,7 +257,7 @@
SelectionMode="Single" SelectionMode="Single"
ContextRequested="OnSubmoduleContextRequested" ContextRequested="OnSubmoduleContextRequested"
DoubleTapped="OnDoubleTappedSubmodule" DoubleTapped="OnDoubleTappedSubmodule"
PropertyChanged="OnLeftSidebarDataGridPropertyChanged" PropertyChanged="OnLeftSidebarListBoxPropertyChanged"
IsVisible="{Binding IsSubmoduleGroupExpanded, Mode=OneWay}"> IsVisible="{Binding IsSubmoduleGroupExpanded, Mode=OneWay}">
<ListBox.Styles> <ListBox.Styles>
<Style Selector="ListBoxItem"> <Style Selector="ListBoxItem">
@ -312,7 +312,7 @@
SelectionMode="Single" SelectionMode="Single"
ContextRequested="OnWorktreeContextRequested" ContextRequested="OnWorktreeContextRequested"
DoubleTapped="OnDoubleTappedWorktree" DoubleTapped="OnDoubleTappedWorktree"
PropertyChanged="OnLeftSidebarDataGridPropertyChanged" PropertyChanged="OnLeftSidebarListBoxPropertyChanged"
IsVisible="{Binding IsWorktreeGroupExpanded, Mode=OneWay}"> IsVisible="{Binding IsWorktreeGroupExpanded, Mode=OneWay}">
<ListBox.Styles> <ListBox.Styles>
<Style Selector="ListBoxItem"> <Style Selector="ListBoxItem">
@ -445,48 +445,53 @@
</ComboBox> </ComboBox>
</Grid> </Grid>
<DataGrid Grid.Row="2" <ListBox Grid.Row="2"
ItemsSource="{Binding SearchedCommits}" ItemsSource="{Binding SearchedCommits}"
SelectionMode="Single" SelectionMode="Single"
SelectedItem="{Binding SearchResultSelectedCommit, Mode=OneWay}" SelectedItem="{Binding SearchResultSelectedCommit, Mode=TwoWay}"
CanUserReorderColumns="False" BorderThickness="1"
CanUserResizeColumns="False" BorderBrush="{DynamicResource Brush.Border2}"
CanUserSortColumns="False" Background="{DynamicResource Brush.Contents}"
IsReadOnly="True" CornerRadius="4"
HeadersVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
Focusable="False" ScrollViewer.VerticalScrollBarVisibility="Auto">
RowHeight="50" <ListBox.Styles>
BorderThickness="1" <Style Selector="ListBoxItem">
BorderBrush="{DynamicResource Brush.Border2}" <Setter Property="Margin" Value="0"/>
Background="{DynamicResource Brush.Contents}" <Setter Property="Padding" Value="0"/>
CornerRadius="4" <Setter Property="Height" Value="50"/>
HorizontalScrollBarVisibility="Disabled" </Style>
VerticalScrollBarVisibility="Auto" <Style Selector="ListBoxItem:selected /template/ ContentPresenter#PART_ContentPresenter">
SelectionChanged="OnSearchResultDataGridSelectionChanged"> <Setter Property="Background" Value="Transparent" />
<DataGrid.Columns> </Style>
<DataGridTemplateColumn Width="*"> <Style Selector="ListBoxItem:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<DataGridTemplateColumn.CellTemplate> <Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
<DataTemplate DataType="m:Commit"> </Style>
<Border BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="0,0,0,1" Padding="4"> </ListBox.Styles>
<Grid RowDefinitions="Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto,Auto">
<v:Avatar Width="16" Height="16"
VerticalAlignment="Center"
IsHitTestVisible="False"
User="{Binding Author}"/>
<TextBlock Grid.Column="1" Classes="primary" Text="{Binding Author.Name}" Margin="8,0,0,0"/>
<TextBlock Grid.Column="2" Classes="primary" Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" Foreground="DarkOrange" Margin="8,0,0,0"/>
<TextBlock Grid.Column="3" Classes="primary" Text="{Binding AuthorTimeShortStr}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
</Grid>
<TextBlock Grid.Row="1" Text="{Binding Subject}" VerticalAlignment="Bottom"/> <ListBox.ItemsPanel>
</Grid> <ItemsPanelTemplate>
</Border> <VirtualizingStackPanel Orientation="Vertical"/>
</DataTemplate> </ItemsPanelTemplate>
</DataGridTemplateColumn.CellTemplate> </ListBox.ItemsPanel>
</DataGridTemplateColumn>
</DataGrid.Columns> <ListBox.ItemTemplate>
</DataGrid> <DataTemplate DataType="m:Commit">
<Border BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="0,0,0,1" Padding="4" Background="Transparent">
<Grid RowDefinitions="Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto,Auto">
<v:Avatar Grid.Column="0" Width="16" Height="16" VerticalAlignment="Center" IsHitTestVisible="False" User="{Binding Author}"/>
<TextBlock Grid.Column="1" Classes="primary" Text="{Binding Author.Name}" Margin="8,0,0,0" ClipToBounds="True"/>
<TextBlock Grid.Column="2" Classes="primary" Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" Foreground="DarkOrange" Margin="8,0,0,0"/>
<TextBlock Grid.Column="3" Classes="primary" Text="{Binding AuthorTimeShortStr}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
</Grid>
<TextBlock Grid.Row="1" Classes="primary" Text="{Binding Subject}" VerticalAlignment="Bottom"/>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Path Grid.Row="2" <Path Grid.Row="2"
HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"

View file

@ -154,16 +154,6 @@ namespace SourceGit.Views
} }
} }
private void OnSearchResultDataGridSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (sender is DataGrid { SelectedItem: Models.Commit commit } && DataContext is ViewModels.Repository repo)
{
repo.NavigateToCommit(commit.SHA);
}
e.Handled = true;
}
private void OnBranchTreeRowsChanged(object _, RoutedEventArgs e) private void OnBranchTreeRowsChanged(object _, RoutedEventArgs e)
{ {
UpdateLeftSidebarLayout(); UpdateLeftSidebarLayout();
@ -236,7 +226,7 @@ namespace SourceGit.Views
e.Handled = true; e.Handled = true;
} }
private void OnLeftSidebarDataGridPropertyChanged(object _, AvaloniaPropertyChangedEventArgs e) private void OnLeftSidebarListBoxPropertyChanged(object _, AvaloniaPropertyChangedEventArgs e)
{ {
if (e.Property == ListBox.ItemsSourceProperty || e.Property == ListBox.IsVisibleProperty) if (e.Property == ListBox.ItemsSourceProperty || e.Property == ListBox.IsVisibleProperty)
UpdateLeftSidebarLayout(); UpdateLeftSidebarLayout();

View file

@ -66,39 +66,42 @@
</Border> </Border>
<!-- Stash List --> <!-- Stash List -->
<DataGrid Grid.Row="2" <ListBox Grid.Row="2"
Background="{DynamicResource Brush.Contents}" Background="{DynamicResource Brush.Contents}"
ItemsSource="{Binding VisibleStashes}" ItemsSource="{Binding VisibleStashes}"
SelectedItem="{Binding SelectedStash, Mode=TwoWay}" SelectedItem="{Binding SelectedStash, Mode=TwoWay}"
SelectionMode="Single" SelectionMode="Single"
CanUserReorderColumns="False" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
CanUserResizeColumns="False" ScrollViewer.VerticalScrollBarVisibility="Auto">
CanUserSortColumns="False" <ListBox.Styles>
IsReadOnly="True" <Style Selector="ListBoxItem">
HeadersVisibility="None" <Setter Property="Margin" Value="0"/>
Focusable="False" <Setter Property="Padding" Value="0"/>
RowHeight="50" <Setter Property="Height" Value="50"/>
HorizontalScrollBarVisibility="Disabled" </Style>
VerticalScrollBarVisibility="Auto"> </ListBox.Styles>
<DataGrid.Columns>
<DataGridTemplateColumn Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="m:Stash">
<Border BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="0,0,0,1" Padding="4" Background="Transparent" ContextRequested="OnStashContextRequested">
<Grid RowDefinitions="Auto,*" >
<Grid Grid.Row="0" ColumnDefinitions="*,Auto">
<TextBlock Grid.Column="0" Classes="primary" Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" Foreground="DarkOrange" TextDecorations="Underline" Cursor="Hand"/>
<TextBlock Grid.Column="1" Classes="primary" Text="{Binding TimeStr}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
</Grid>
<TextBlock Grid.Row="1" Classes="primary" Text="{Binding Message}" VerticalAlignment="Bottom"/> <ListBox.ItemsPanel>
</Grid> <ItemsPanelTemplate>
</Border> <VirtualizingStackPanel Orientation="Vertical"/>
</DataTemplate> </ItemsPanelTemplate>
</DataGridTemplateColumn.CellTemplate> </ListBox.ItemsPanel>
</DataGridTemplateColumn>
</DataGrid.Columns> <ListBox.ItemTemplate>
</DataGrid> <DataTemplate DataType="m:Stash">
<Border BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="0,0,0,1" Padding="4" Background="Transparent" ContextRequested="OnStashContextRequested">
<Grid RowDefinitions="Auto,*" >
<Grid Grid.Row="0" ColumnDefinitions="*,Auto">
<TextBlock Grid.Column="0" Classes="primary" Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" Foreground="DarkOrange" TextDecorations="Underline" Cursor="Hand"/>
<TextBlock Grid.Column="1" Classes="primary" Text="{Binding TimeStr}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
</Grid>
<TextBlock Grid.Row="1" Classes="primary" Text="{Binding Message}" VerticalAlignment="Bottom"/>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!-- Changes Bar --> <!-- Changes Bar -->
<Border Grid.Row="3" BorderThickness="0,1" BorderBrush="{DynamicResource Brush.Border0}"> <Border Grid.Row="3" BorderThickness="0,1" BorderBrush="{DynamicResource Brush.Border0}">
@ -110,38 +113,36 @@
</Border> </Border>
<!-- View Changes --> <!-- View Changes -->
<DataGrid Grid.Row="4" <ListBox Grid.Row="4"
Background="{DynamicResource Brush.Contents}" Background="{DynamicResource Brush.Contents}"
ItemsSource="{Binding Changes}" ItemsSource="{Binding Changes}"
SelectedItem="{Binding SelectedChange, Mode=TwoWay}" SelectedItem="{Binding SelectedChange, Mode=TwoWay}"
SelectionMode="Single" SelectionMode="Single"
CanUserReorderColumns="False" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
CanUserResizeColumns="False" ScrollViewer.VerticalScrollBarVisibility="Auto">
CanUserSortColumns="False" <ListBox.Styles>
IsReadOnly="True" <Style Selector="ListBoxItem">
HeadersVisibility="None" <Setter Property="Margin" Value="0"/>
Focusable="False" <Setter Property="Padding" Value="0"/>
RowHeight="26" <Setter Property="Height" Value="26"/>
HorizontalScrollBarVisibility="Auto" </Style>
VerticalScrollBarVisibility="Auto"> </ListBox.Styles>
<DataGrid.Columns>
<DataGridTemplateColumn Header="ICON">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<v:ChangeStatusIcon Width="14" Height="14" Change="{Binding}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="PATH"> <ListBox.ItemsPanel>
<DataGridTemplateColumn.CellTemplate> <ItemsPanelTemplate>
<DataTemplate> <VirtualizingStackPanel Orientation="Vertical"/>
<TextBlock Classes="primary" Text="{Binding Path}" Margin="4,0,0,0"/> </ItemsPanelTemplate>
</DataTemplate> </ListBox.ItemsPanel>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> <ListBox.ItemTemplate>
</DataGrid.Columns> <DataTemplate DataType="m:Change">
</DataGrid> <Grid ColumnDefinitions="24,*">
<v:ChangeStatusIcon Grid.Column="0" Width="14" Height="14" Change="{Binding}"/>
<TextBlock Grid.Column="1" Classes="primary" Text="{Binding Path}" Margin="4,0,0,0"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid> </Grid>
<GridSplitter Grid.Column="1" <GridSplitter Grid.Column="1"

View file

@ -134,46 +134,43 @@
<Grid ColumnDefinitions="256,*" Margin="8,8,8,16"> <Grid ColumnDefinitions="256,*" Margin="8,8,8,16">
<Grid Grid.Column="0" RowDefinitions="*,16"> <Grid Grid.Column="0" RowDefinitions="*,16">
<!-- Table By Committer --> <!-- Table By Committer -->
<DataGrid Grid.Row="0" <ListBox Grid.Column="0"
ItemsSource="{Binding ByCommitter}" ItemsSource="{Binding ByCommitter}"
SelectionMode="Single" SelectionMode="Single"
CanUserReorderColumns="False" BorderThickness="1"
CanUserResizeColumns="False" BorderBrush="{DynamicResource Brush.Border2}"
CanUserSortColumns="False" Background="{DynamicResource Brush.Contents}"
HeadersVisibility="Column" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
GridLinesVisibility="All" ScrollViewer.VerticalScrollBarVisibility="Auto">
BorderThickness="1" <ListBox.Styles>
BorderBrush="{DynamicResource Brush.Border2}" <Style Selector="ListBoxItem">
Background="{DynamicResource Brush.Contents}" <Setter Property="Margin" Value="0"/>
HorizontalGridLinesBrush="{DynamicResource Brush.Border2}" <Setter Property="Padding" Value="0"/>
VerticalGridLinesBrush="{DynamicResource Brush.Border2}" <Setter Property="Height" Value="26"/>
IsReadOnly="True"
RowHeight="26"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<DataGrid.Styles>
<Style Selector="DataGridColumnHeader">
<Setter Property="Background" Value="{DynamicResource Brush.Window}"/>
<Setter Property="Padding" Value="8,0,0,0"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border2}"/>
<Setter Property="SeparatorBrush" Value="{DynamicResource Brush.Border2}" />
<Style Selector="^:pointerover /template/ Grid#PART_ColumnHeaderRoot">
<Setter Property="Background" Value="{DynamicResource Brush.Window}"/>
</Style>
<Style Selector="^:pressed /template/ Grid#PART_ColumnHeaderRoot">
<Setter Property="Background" Value="{DynamicResource Brush.Window}"/>
</Style>
</Style> </Style>
</DataGrid.Styles> </ListBox.Styles>
<DataGrid.Columns> <ListBox.ItemsPanel>
<DataGridTextColumn Width="150" Header="{DynamicResource Text.Statistics.Committer}" Binding="{Binding Name}"/> <ItemsPanelTemplate>
<DataGridTextColumn Width="*" Header="{DynamicResource Text.Statistics.CommitAmount}" Binding="{Binding Count}"/> <VirtualizingStackPanel Orientation="Vertical"/>
</DataGrid.Columns> </ItemsPanelTemplate>
</DataGrid> </ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate DataType="m:StatisticsSample">
<Border BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border2}">
<Grid ColumnDefinitions="*,150">
<Border Grid.Column="0" Padding="8,0" ClipToBounds="True">
<TextBlock Text="{Binding Name}" HorizontalAlignment="Left"/>
</Border>
<Border Grid.Column="1" Padding="8,0" ClipToBounds="True">
<TextBlock Text="{Binding Count}" HorizontalAlignment="Right"/>
</Border>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!-- Summary --> <!-- Summary -->
<Grid Grid.Row="1" ColumnDefinitions="*,*"> <Grid Grid.Row="1" ColumnDefinitions="*,*">