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

@ -17,26 +17,24 @@
<!-- Left panel -->
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Stash list -->
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
<RowDefinition Height="24"/>
<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}"/>
</Border>
<!-- Stashes list -->
<ListView
Grid.Row="2"
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"
@ -44,6 +42,7 @@
<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>
@ -66,20 +65,10 @@
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<!-- Splitter -->
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>
<!-- 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,13 +77,14 @@
<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="2"
Grid.Row="3"
Background="{StaticResource Brush.Contents}" BorderThickness="0"
Style="{StaticResource Style.ListView.Borderless}"
SelectedIndex="-1"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
@ -127,7 +117,6 @@
</ListView.ItemTemplate>
</ListView>
</Grid>
</Grid>
<!-- Splitter -->
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>

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="*"/>
</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,7 +72,9 @@
<Path Width="14" Height="14" Data="{StaticResource Icon.DoubleDown}" Opacity=".4"/>
</Button>
</Grid>
</Border>
<!-- Unstage changes tree view mode -->
<TreeView
Grid.Row="1"
x:Name="unstagedTree"
@ -134,8 +130,9 @@
</TreeView.ItemTemplate>
</TreeView>
<!-- Unstaged changes list/grid view mode -->
<DataGrid
Grid.Row="2"
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}}"
@ -203,19 +200,10 @@
</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,9 +223,11 @@
<Path Width="14" Height="14" Data="{StaticResource Icon.DoubleUp}" Opacity=".4"/>
</Button>
</Grid>
</Border>
<!-- Staged changes tree view mode -->
<TreeView
Grid.Row="1"
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}}"
@ -294,7 +282,7 @@
</TreeView>
<DataGrid
Grid.Row="2"
Grid.Row="3"
x:Name="stageList"
ItemsSource="{Binding ElementName=me, Path=StagedListData, IsAsync=False}"
RowHeight="24"
@ -363,7 +351,6 @@
</DataGrid.RowStyle>
</DataGrid>
</Grid>
</Grid>
<!-- Splitter -->
<GridSplitter Grid.Column="1" Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>