style<*>: enable SnapsToDevicePixels for borders

This commit is contained in:
leo 2021-04-06 10:59:50 +08:00
parent d56eab9592
commit eba5d456f0
4 changed files with 332 additions and 356 deletions

View file

@ -111,7 +111,7 @@
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" MinWidth="200" MaxWidth="300"/>
<ColumnDefinition Width="1" MaxWidth="1"/>
<ColumnDefinition Width="1"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
@ -481,7 +481,7 @@
</Grid>
<!-- Splitter -->
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>
<GridSplitter Grid.Column="1" HorizontalAlignment="Center" Width="1" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>
<!-- Right -->
<Grid Grid.Column="2">

View file

@ -10,7 +10,7 @@
<Border Background="Transparent" MouseLeftButtonDown="Close"/>
<Grid HorizontalAlignment="Center" VerticalAlignment="Top" Width="Auto" Height="Auto" Background="{StaticResource Brush.Popup}">
<Border x:Name="popupContent" Padding="8" Width="Auto" Height="Auto" BorderThickness="1,0,1,1" BorderBrush="{StaticResource Brush.Border0}"/>
<Border x:Name="popupContent" Padding="8" Width="Auto" Height="Auto" BorderThickness="1,0,1,1" BorderBrush="{StaticResource Brush.Border0}" SnapsToDevicePixels="True"/>
<Border x:Name="status" Visibility="Collapsed" Background="{StaticResource Brush.Popup}" Margin="1,0,1,1" Opacity=".9">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">

View file

@ -18,68 +18,57 @@
<!-- Left panel -->
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
<RowDefinition Height="1"/>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Stash list -->
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Stashes list toolbar -->
<Border Grid.Row="0" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,0,1" SnapsToDevicePixels="True">
<Label Content="{StaticResource Text.Stashes.Stashes}" Foreground="{StaticResource Brush.FG2}" Margin="4,0,0,0" FontWeight="Bold"/>
<Rectangle Grid.Row="1" HorizontalAlignment="Stretch" Height="1" Fill="{StaticResource Brush.Border0}"/>
<ListView
Grid.Row="2"
x:Name="stashList"
Background="{StaticResource Brush.Contents}" BorderThickness="0"
SelectedIndex="-1"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
SelectionChanged="StashSelectionChanged">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource Style.ListViewItem.Borderless}">
<Setter Property="Padding" Value="0"/>
<EventSetter Event="ContextMenuOpening" Handler="StashContextMenuOpening"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate DataType="{x:Type git:Stash}">
<Border BorderBrush="{StaticResource Brush.Border3}" BorderThickness="0,0,0,1" Padding="4">
<StackPanel Orientation="Vertical" Margin="2" MaxWidth="290">
<Grid TextBlock.Foreground="{StaticResource Brush.FG2}" TextBlock.FontSize="11">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
</Border>
<TextBlock Grid.Column="0" Text="{Binding SHA}"/>
<TextBlock Grid.Column="1" Text="{Binding Author.Time}"/>
</Grid>
<TextBlock MaxWidth="280" Foreground="{StaticResource Brush.FG1}" Text="{Binding Message}" TextAlignment="Left" Padding="0" Margin="0,8,2,0"/>
</StackPanel>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<!-- Stashes list -->
<ListView
Grid.Row="1"
x:Name="stashList"
Background="{StaticResource Brush.Contents}" BorderThickness="0"
Style="{StaticResource Style.ListView.Borderless}"
SelectedIndex="-1"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
SelectionChanged="StashSelectionChanged">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource Style.ListViewItem.Borderless}">
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="0"/>
<EventSetter Event="ContextMenuOpening" Handler="StashContextMenuOpening"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate DataType="{x:Type git:Stash}">
<Border BorderBrush="{StaticResource Brush.Border3}" BorderThickness="0,0,0,1" Padding="4">
<StackPanel Orientation="Vertical" Margin="2" MaxWidth="290">
<Grid TextBlock.Foreground="{StaticResource Brush.FG2}" TextBlock.FontSize="11">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Splitter -->
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>
<TextBlock Grid.Column="0" Text="{Binding SHA}"/>
<TextBlock Grid.Column="1" Text="{Binding Author.Time}"/>
</Grid>
<TextBlock MaxWidth="280" Foreground="{StaticResource Brush.FG1}" Text="{Binding Message}" TextAlignment="Left" Padding="0" Margin="0,8,2,0"/>
</StackPanel>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<!-- Changed file in this stash -->
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<!-- Changed file toolbar -->
<Border Grid.Row="2" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,1,0,1" SnapsToDevicePixels="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
@ -88,45 +77,45 @@
<Label Grid.Column="0" Content="{StaticResource Text.Stashes.Changes}" Foreground="{StaticResource Brush.FG2}" Margin="4,0,0,0" FontWeight="Bold"/>
<Label Grid.Column="1" Content="{StaticResource Text.Stashes.Changes.Tip}" Foreground="{StaticResource Brush.FG2}" FontSize="10"/>
</Grid>
</Border>
<Rectangle Grid.Row="1" HorizontalAlignment="Stretch" Height="1" Fill="{StaticResource Brush.Border0}"/>
<!-- Change files -->
<ListView
x:Name="changeList"
Grid.Row="3"
Background="{StaticResource Brush.Contents}" BorderThickness="0"
Style="{StaticResource Style.ListView.Borderless}"
SelectedIndex="-1"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
SelectionChanged="FileSelectionChanged">
<ListView.Resources>
<converters:FileStatusToColor x:Key="StatusColorConverter"/>
<converters:FileStatusToIcon x:Key="StatusIconConverter"/>
</ListView.Resources>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource Style.ListViewItem.Borderless}">
<Setter Property="Padding" Value="0"/>
<Setter Property="TextBlock.FontFamily" Value="Consolas"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate DataType="{x:Type git:Change}">
<Grid Height="24">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ListView
x:Name="changeList"
Grid.Row="2"
Background="{StaticResource Brush.Contents}" BorderThickness="0"
SelectedIndex="-1"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
SelectionChanged="FileSelectionChanged">
<ListView.Resources>
<converters:FileStatusToColor x:Key="StatusColorConverter"/>
<converters:FileStatusToIcon x:Key="StatusIconConverter"/>
</ListView.Resources>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource Style.ListViewItem.Borderless}">
<Setter Property="Padding" Value="0"/>
<Setter Property="TextBlock.FontFamily" Value="Consolas"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate DataType="{x:Type git:Change}">
<Grid Height="24">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Width="14" Height="14" Background="{Binding ., Converter={StaticResource StatusColorConverter}}" CornerRadius="2" Margin="0,0,4,0">
<TextBlock Text="{Binding ., Converter={StaticResource StatusIconConverter}}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" FontSize="10"/>
</Border>
<Border Grid.Column="0" Width="14" Height="14" Background="{Binding ., Converter={StaticResource StatusColorConverter}}" CornerRadius="2" Margin="0,0,4,0">
<TextBlock Text="{Binding ., Converter={StaticResource StatusIconConverter}}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" FontSize="10"/>
</Border>
<TextBlock Grid.Column="1" Text="{Binding Path}" Foreground="{StaticResource Brush.FG1}" VerticalAlignment="Center" FontSize="11"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<TextBlock Grid.Column="1" Text="{Binding Path}" Foreground="{StaticResource Brush.FG1}" VerticalAlignment="Center" FontSize="11"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<!-- Splitter -->

View file

@ -29,26 +29,22 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="1" MaxWidth="1"/>
<ColumnDefinition Width="1"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Left -->
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
<RowDefinition Height="1"/>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Unstaged changes -->
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<!-- Unstaged changes toolbar -->
<Border Grid.Row="0" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,0,1" SnapsToDevicePixels="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
@ -58,8 +54,6 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Grid.ColumnSpan="6" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,0,1"/>
<local:FilesDisplayModeSwitch
Grid.Column="0"
Mode="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Mode=TwoWay}"/>
@ -78,144 +72,138 @@
<Path Width="14" Height="14" Data="{StaticResource Icon.DoubleDown}" Opacity=".4"/>
</Button>
</Grid>
</Border>
<TreeView
Grid.Row="1"
x:Name="unstagedTree"
ItemsSource="{Binding ElementName=me, Path=UnstagedTreeData, IsAsync=True}"
Background="{StaticResource Brush.Contents}"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Converter={StaticResource FilesDisplayModeToTree}}"
FontFamily="Consolas"
PreviewMouseWheel="TreeMouseWheel"
helpers:TreeViewHelper.EnableMultiSelection="True"
helpers:TreeViewHelper.MultiSelectionChanged="UnstagedTreeMultiSelectionChanged">
<TreeView.Resources>
<RoutedUICommand x:Key="SelectWholeTreeCommand" Text="SelectWholeTree"/>
</TreeView.Resources>
<!-- Unstage changes tree view mode -->
<TreeView
Grid.Row="1"
x:Name="unstagedTree"
ItemsSource="{Binding ElementName=me, Path=UnstagedTreeData, IsAsync=True}"
Background="{StaticResource Brush.Contents}"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Converter={StaticResource FilesDisplayModeToTree}}"
FontFamily="Consolas"
PreviewMouseWheel="TreeMouseWheel"
helpers:TreeViewHelper.EnableMultiSelection="True"
helpers:TreeViewHelper.MultiSelectionChanged="UnstagedTreeMultiSelectionChanged">
<TreeView.Resources>
<RoutedUICommand x:Key="SelectWholeTreeCommand" Text="SelectWholeTree"/>
</TreeView.Resources>
<TreeView.InputBindings>
<KeyBinding Key="A" Modifiers="Ctrl" Command="{StaticResource SelectWholeTreeCommand}"/>
</TreeView.InputBindings>
<TreeView.InputBindings>
<KeyBinding Key="A" Modifiers="Ctrl" Command="{StaticResource SelectWholeTreeCommand}"/>
</TreeView.InputBindings>
<TreeView.CommandBindings>
<CommandBinding Command="{StaticResource SelectWholeTreeCommand}" Executed="SelectWholeTree"/>
</TreeView.CommandBindings>
<TreeView.CommandBindings>
<CommandBinding Command="{StaticResource SelectWholeTreeCommand}" Executed="SelectWholeTree"/>
</TreeView.CommandBindings>
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource Style.TreeView.MultiSelectionItemContainerStyle}">
<Setter Property="IsExpanded" Value="{Binding IsNodeExpanded, Mode=TwoWay}"/>
<EventSetter Event="ContextMenuOpening" Handler="UnstagedTreeContextMenuOpening"/>
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal" Height="24">
<Border x:Name="status" Width="14" Height="14" Visibility="Collapsed" Background="{Binding Change, Converter={StaticResource UnstagedStatusConverter}}" CornerRadius="2" Margin="0,0,4,0">
<TextBlock Text="{Binding Change, Converter={StaticResource UnstagedStatusIconConverter}}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" FontSize="10" RenderOptions.BitmapScalingMode="HighQuality"/>
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource Style.TreeView.MultiSelectionItemContainerStyle}">
<Setter Property="IsExpanded" Value="{Binding IsNodeExpanded, Mode=TwoWay}"/>
<EventSetter Event="ContextMenuOpening" Handler="UnstagedTreeContextMenuOpening"/>
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal" Height="24">
<Border x:Name="status" Width="14" Height="14" Visibility="Collapsed" Background="{Binding Change, Converter={StaticResource UnstagedStatusConverter}}" CornerRadius="2" Margin="0,0,4,0">
<TextBlock Text="{Binding Change, Converter={StaticResource UnstagedStatusIconConverter}}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" FontSize="10" RenderOptions.BitmapScalingMode="HighQuality"/>
</Border>
<Path x:Name="icon" Width="14" Fill="Goldenrod" Data="{StaticResource Icon.Folder.Fill}"/>
<TextBlock Text="{Binding Name}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" Margin="4,0,0,0" FontSize="11"/>
</StackPanel>
<HierarchicalDataTemplate.Triggers>
<DataTrigger Binding="{Binding IsFile}" Value="True">
<Setter TargetName="status" Property="Visibility" Value="Visible"/>
<Setter TargetName="icon" Property="Visibility" Value="Collapsed"/>
</DataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsFile}" Value="False"/>
<Condition Binding="{Binding IsNodeExpanded}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter TargetName="icon" Property="Data" Value="{StaticResource Icon.Folder.Open}"/>
</MultiDataTrigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<!-- Unstaged changes list/grid view mode -->
<DataGrid
Grid.Row="1"
x:Name="unstagedList"
ItemsSource="{Binding ElementName=me, Path=UnstagedListData, IsAsync=True}"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Converter={StaticResource FilesDisplayModeToList}}"
RowHeight="24"
SelectionChanged="UnstagedListSelectionChanged"
SelectionMode="Extended"
SelectionUnit="FullRow"
Background="{StaticResource Brush.Contents}">
<DataGrid.Resources>
<Style x:Key="Style.DataGridText.VerticalCenter" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="4,0"/>
</Style>
<RoutedUICommand x:Key="SelectWholeDataGridCommand" Text="SelectWholeDataGrid"/>
</DataGrid.Resources>
<DataGrid.InputBindings>
<KeyBinding Key="A" Modifiers="Ctrl" Command="{StaticResource SelectWholeDataGridCommand}"/>
</DataGrid.InputBindings>
<DataGrid.CommandBindings>
<CommandBinding Command="{StaticResource SelectWholeDataGridCommand}" Executed="SelectWholeDataGrid"/>
</DataGrid.CommandBindings>
<DataGrid.Columns>
<DataGridTemplateColumn Width="22">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border Width="14" Height="14" x:Name="status" Background="{Binding ., Converter={StaticResource UnstagedStatusConverter}}" CornerRadius="2" Margin="2,0">
<TextBlock Text="{Binding ., Converter={StaticResource UnstagedStatusIconConverter}}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" FontSize="8"/>
</Border>
<Path x:Name="icon" Width="14" Fill="Goldenrod" Data="{StaticResource Icon.Folder.Fill}"/>
<TextBlock Text="{Binding Name}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" Margin="4,0,0,0" FontSize="11"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<HierarchicalDataTemplate.Triggers>
<DataTrigger Binding="{Binding IsFile}" Value="True">
<Setter TargetName="status" Property="Visibility" Value="Visible"/>
<Setter TargetName="icon" Property="Visibility" Value="Collapsed"/>
</DataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsFile}" Value="False"/>
<Condition Binding="{Binding IsNodeExpanded}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter TargetName="icon" Property="Data" Value="{StaticResource Icon.Folder.Open}"/>
</MultiDataTrigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<DataGridTextColumn
Width="Auto"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Converter={StaticResource FilesDisplayModeToGrid}}"
Binding="{Binding Path, Converter={StaticResource PathToFileName}}"
Foreground="{StaticResource Brush.FG1}"
FontFamily="Consolas"
ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
<DataGrid
Grid.Row="2"
x:Name="unstagedList"
ItemsSource="{Binding ElementName=me, Path=UnstagedListData, IsAsync=True}"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Converter={StaticResource FilesDisplayModeToList}}"
RowHeight="24"
SelectionChanged="UnstagedListSelectionChanged"
SelectionMode="Extended"
SelectionUnit="FullRow"
Background="{StaticResource Brush.Contents}">
<DataGrid.Resources>
<Style x:Key="Style.DataGridText.VerticalCenter" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="4,0"/>
</Style>
<DataGridTextColumn
Width="*"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Converter={StaticResource FilesDisplayModeToGrid}}"
Binding="{Binding Path, Converter={StaticResource PathToFolderName}}"
Foreground="{StaticResource Brush.FG2}"
FontFamily="Consolas"
ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
<RoutedUICommand x:Key="SelectWholeDataGridCommand" Text="SelectWholeDataGrid"/>
</DataGrid.Resources>
<DataGridTextColumn
Width="*"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Converter={StaticResource FilesDisplayModeToListOnly}}"
Binding="{Binding Path}"
Foreground="{StaticResource Brush.FG1}"
FontFamily="Consolas"
ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
</DataGrid.Columns>
<DataGrid.InputBindings>
<KeyBinding Key="A" Modifiers="Ctrl" Command="{StaticResource SelectWholeDataGridCommand}"/>
</DataGrid.InputBindings>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
<EventSetter Event="ContextMenuOpening" Handler="UnstagedListContextMenuOpening"/>
</Style>
</DataGrid.RowStyle>
</DataGrid>
<DataGrid.CommandBindings>
<CommandBinding Command="{StaticResource SelectWholeDataGridCommand}" Executed="SelectWholeDataGrid"/>
</DataGrid.CommandBindings>
<DataGrid.Columns>
<DataGridTemplateColumn Width="22">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border Width="14" Height="14" x:Name="status" Background="{Binding ., Converter={StaticResource UnstagedStatusConverter}}" CornerRadius="2" Margin="2,0">
<TextBlock Text="{Binding ., Converter={StaticResource UnstagedStatusIconConverter}}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" FontSize="8"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="Auto"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Converter={StaticResource FilesDisplayModeToGrid}}"
Binding="{Binding Path, Converter={StaticResource PathToFileName}}"
Foreground="{StaticResource Brush.FG1}"
FontFamily="Consolas"
ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
<DataGridTextColumn
Width="*"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Converter={StaticResource FilesDisplayModeToGrid}}"
Binding="{Binding Path, Converter={StaticResource PathToFolderName}}"
Foreground="{StaticResource Brush.FG2}"
FontFamily="Consolas"
ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
<DataGridTextColumn
Width="*"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Converter={StaticResource FilesDisplayModeToListOnly}}"
Binding="{Binding Path}"
Foreground="{StaticResource Brush.FG1}"
FontFamily="Consolas"
ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
<EventSetter Event="ContextMenuOpening" Handler="UnstagedListContextMenuOpening"/>
</Style>
</DataGrid.RowStyle>
</DataGrid>
</Grid>
<!-- Splitter -->
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>
<!-- Staged changes -->
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<!-- Staged changes toolbar -->
<Border Grid.Row="2" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,1,0,1" SnapsToDevicePixels="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
@ -224,8 +212,6 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Grid.ColumnSpan="5" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,0,1"/>
<local:FilesDisplayModeSwitch
Grid.Column="0"
Mode="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Mode=TwoWay}"/>
@ -237,132 +223,133 @@
<Path Width="14" Height="14" Data="{StaticResource Icon.DoubleUp}" Opacity=".4"/>
</Button>
</Grid>
</Border>
<TreeView
Grid.Row="1"
x:Name="stageTree"
ItemsSource="{Binding ElementName=me, Path=StagedTreeData, IsAsync=False}"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToTree}}"
Background="{StaticResource Brush.Contents}"
FontFamily="Consolas"
PreviewMouseWheel="TreeMouseWheel"
helpers:TreeViewHelper.EnableMultiSelection="True"
helpers:TreeViewHelper.MultiSelectionChanged="StageTreeMultiSelectionChanged">
<TreeView.Resources>
<RoutedUICommand x:Key="SelectWholeTreeCommand" Text="SelectWholeTree"/>
</TreeView.Resources>
<!-- Staged changes tree view mode -->
<TreeView
Grid.Row="3"
x:Name="stageTree"
ItemsSource="{Binding ElementName=me, Path=StagedTreeData, IsAsync=False}"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToTree}}"
Background="{StaticResource Brush.Contents}"
FontFamily="Consolas"
PreviewMouseWheel="TreeMouseWheel"
helpers:TreeViewHelper.EnableMultiSelection="True"
helpers:TreeViewHelper.MultiSelectionChanged="StageTreeMultiSelectionChanged">
<TreeView.Resources>
<RoutedUICommand x:Key="SelectWholeTreeCommand" Text="SelectWholeTree"/>
</TreeView.Resources>
<TreeView.InputBindings>
<KeyBinding Key="A" Modifiers="Ctrl" Command="{StaticResource SelectWholeTreeCommand}"/>
</TreeView.InputBindings>
<TreeView.InputBindings>
<KeyBinding Key="A" Modifiers="Ctrl" Command="{StaticResource SelectWholeTreeCommand}"/>
</TreeView.InputBindings>
<TreeView.CommandBindings>
<CommandBinding Command="{StaticResource SelectWholeTreeCommand}" Executed="SelectWholeTree"/>
</TreeView.CommandBindings>
<TreeView.CommandBindings>
<CommandBinding Command="{StaticResource SelectWholeTreeCommand}" Executed="SelectWholeTree"/>
</TreeView.CommandBindings>
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource Style.TreeView.MultiSelectionItemContainerStyle}">
<Setter Property="IsExpanded" Value="{Binding IsNodeExpanded, Mode=TwoWay}"/>
<EventSetter Event="ContextMenuOpening" Handler="StageTreeContextMenuOpening"/>
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal" Height="24">
<Border x:Name="status" Width="14" Height="14" Visibility="Collapsed" Background="{Binding Change, Converter={StaticResource StagedStatusConverter}}" CornerRadius="2" Margin="0,0,4,0">
<TextBlock Text="{Binding Change, Converter={StaticResource StagedStatusIconConverter}}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" FontSize="10" RenderOptions.BitmapScalingMode="HighQuality"/>
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource Style.TreeView.MultiSelectionItemContainerStyle}">
<Setter Property="IsExpanded" Value="{Binding IsNodeExpanded, Mode=TwoWay}"/>
<EventSetter Event="ContextMenuOpening" Handler="StageTreeContextMenuOpening"/>
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal" Height="24">
<Border x:Name="status" Width="14" Height="14" Visibility="Collapsed" Background="{Binding Change, Converter={StaticResource StagedStatusConverter}}" CornerRadius="2" Margin="0,0,4,0">
<TextBlock Text="{Binding Change, Converter={StaticResource StagedStatusIconConverter}}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" FontSize="10" RenderOptions.BitmapScalingMode="HighQuality"/>
</Border>
<Path x:Name="icon" Width="14" Fill="Goldenrod" Data="{StaticResource Icon.Folder.Fill}"/>
<TextBlock Text="{Binding Name}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" Margin="4,0,0,0" FontSize="11"/>
</StackPanel>
<HierarchicalDataTemplate.Triggers>
<DataTrigger Binding="{Binding IsFile}" Value="True">
<Setter TargetName="status" Property="Visibility" Value="Visible"/>
<Setter TargetName="icon" Property="Visibility" Value="Collapsed"/>
</DataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsFile}" Value="False"/>
<Condition Binding="{Binding IsNodeExpanded}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter TargetName="icon" Property="Data" Value="{StaticResource Icon.Folder.Open}"/>
</MultiDataTrigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<DataGrid
Grid.Row="3"
x:Name="stageList"
ItemsSource="{Binding ElementName=me, Path=StagedListData, IsAsync=False}"
RowHeight="24"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToList}}"
SelectionChanged="StagedListSelectionChanged"
SelectionMode="Extended"
SelectionUnit="FullRow"
Background="{StaticResource Brush.Contents}">
<DataGrid.Resources>
<Style x:Key="Style.DataGridText.VerticalCenter" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="4,0"/>
</Style>
<RoutedUICommand x:Key="SelectWholeDataGridCommand" Text="SelectWholeDataGrid"/>
</DataGrid.Resources>
<DataGrid.InputBindings>
<KeyBinding Key="A" Modifiers="Ctrl" Command="{StaticResource SelectWholeDataGridCommand}"/>
</DataGrid.InputBindings>
<DataGrid.CommandBindings>
<CommandBinding Command="{StaticResource SelectWholeDataGridCommand}" Executed="SelectWholeDataGrid"/>
</DataGrid.CommandBindings>
<DataGrid.Columns>
<DataGridTemplateColumn Width="22">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border Width="14" Height="14" x:Name="status" Background="{Binding ., Converter={StaticResource StagedStatusConverter}}" CornerRadius="2" Margin="2,0">
<TextBlock Text="{Binding ., Converter={StaticResource StagedStatusIconConverter}}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" FontSize="8"/>
</Border>
<Path x:Name="icon" Width="14" Fill="Goldenrod" Data="{StaticResource Icon.Folder.Fill}"/>
<TextBlock Text="{Binding Name}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" Margin="4,0,0,0" FontSize="11"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<HierarchicalDataTemplate.Triggers>
<DataTrigger Binding="{Binding IsFile}" Value="True">
<Setter TargetName="status" Property="Visibility" Value="Visible"/>
<Setter TargetName="icon" Property="Visibility" Value="Collapsed"/>
</DataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsFile}" Value="False"/>
<Condition Binding="{Binding IsNodeExpanded}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter TargetName="icon" Property="Data" Value="{StaticResource Icon.Folder.Open}"/>
</MultiDataTrigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<DataGridTextColumn
Width="Auto"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToGrid}}"
Binding="{Binding Path, Converter={StaticResource PathToFileName}}"
Foreground="{StaticResource Brush.FG1}"
FontFamily="Consolas"
ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
<DataGrid
Grid.Row="2"
x:Name="stageList"
ItemsSource="{Binding ElementName=me, Path=StagedListData, IsAsync=False}"
RowHeight="24"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToList}}"
SelectionChanged="StagedListSelectionChanged"
SelectionMode="Extended"
SelectionUnit="FullRow"
Background="{StaticResource Brush.Contents}">
<DataGrid.Resources>
<Style x:Key="Style.DataGridText.VerticalCenter" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="4,0"/>
</Style>
<DataGridTextColumn
Width="*"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToGrid}}"
Binding="{Binding Path, Converter={StaticResource PathToFolderName}}"
Foreground="{StaticResource Brush.FG2}"
FontFamily="Consolas"
ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
<RoutedUICommand x:Key="SelectWholeDataGridCommand" Text="SelectWholeDataGrid"/>
</DataGrid.Resources>
<DataGridTextColumn
Width="*"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToListOnly}}"
Binding="{Binding Path}"
Foreground="{StaticResource Brush.FG1}"
FontFamily="Consolas"
ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
</DataGrid.Columns>
<DataGrid.InputBindings>
<KeyBinding Key="A" Modifiers="Ctrl" Command="{StaticResource SelectWholeDataGridCommand}"/>
</DataGrid.InputBindings>
<DataGrid.CommandBindings>
<CommandBinding Command="{StaticResource SelectWholeDataGridCommand}" Executed="SelectWholeDataGrid"/>
</DataGrid.CommandBindings>
<DataGrid.Columns>
<DataGridTemplateColumn Width="22">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border Width="14" Height="14" x:Name="status" Background="{Binding ., Converter={StaticResource StagedStatusConverter}}" CornerRadius="2" Margin="2,0">
<TextBlock Text="{Binding ., Converter={StaticResource StagedStatusIconConverter}}" Foreground="{StaticResource Brush.FG1}" TextAlignment="Center" VerticalAlignment="Center" FontSize="8"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="Auto"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToGrid}}"
Binding="{Binding Path, Converter={StaticResource PathToFileName}}"
Foreground="{StaticResource Brush.FG1}"
FontFamily="Consolas"
ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
<DataGridTextColumn
Width="*"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToGrid}}"
Binding="{Binding Path, Converter={StaticResource PathToFolderName}}"
Foreground="{StaticResource Brush.FG2}"
FontFamily="Consolas"
ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
<DataGridTextColumn
Width="*"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToListOnly}}"
Binding="{Binding Path}"
Foreground="{StaticResource Brush.FG1}"
FontFamily="Consolas"
ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
<EventSetter Event="ContextMenuOpening" Handler="StagedListContextMenuOpening"/>
</Style>
</DataGrid.RowStyle>
</DataGrid>
</Grid>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
<EventSetter Event="ContextMenuOpening" Handler="StagedListContextMenuOpening"/>
</Style>
</DataGrid.RowStyle>
</DataGrid>
</Grid>
<!-- Splitter -->