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 Grid.Row="1">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="200" MinWidth="200" MaxWidth="300"/> <ColumnDefinition Width="200" MinWidth="200" MaxWidth="300"/>
<ColumnDefinition Width="1" MaxWidth="1"/> <ColumnDefinition Width="1"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
@ -481,7 +481,7 @@
</Grid> </Grid>
<!-- Splitter --> <!-- 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 --> <!-- Right -->
<Grid Grid.Column="2"> <Grid Grid.Column="2">

View file

@ -10,7 +10,7 @@
<Border Background="Transparent" MouseLeftButtonDown="Close"/> <Border Background="Transparent" MouseLeftButtonDown="Close"/>
<Grid HorizontalAlignment="Center" VerticalAlignment="Top" Width="Auto" Height="Auto" Background="{StaticResource Brush.Popup}"> <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"> <Border x:Name="status" Visibility="Collapsed" Background="{StaticResource Brush.Popup}" Margin="1,0,1,1" Opacity=".9">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">

View file

@ -17,26 +17,24 @@
<!-- Left panel --> <!-- Left panel -->
<Grid Grid.Column="0"> <Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Stash list -->
<Grid Grid.Row="0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="24"/> <RowDefinition Height="24"/>
<RowDefinition Height="1"/> <RowDefinition Height="*"/>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </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"/> <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 <ListView
Grid.Row="2" Grid.Row="1"
x:Name="stashList" x:Name="stashList"
Background="{StaticResource Brush.Contents}" BorderThickness="0" Background="{StaticResource Brush.Contents}" BorderThickness="0"
Style="{StaticResource Style.ListView.Borderless}"
SelectedIndex="-1" SelectedIndex="-1"
ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
@ -44,6 +42,7 @@
<ListView.ItemContainerStyle> <ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource Style.ListViewItem.Borderless}"> <Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource Style.ListViewItem.Borderless}">
<Setter Property="Padding" Value="0"/> <Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="0"/>
<EventSetter Event="ContextMenuOpening" Handler="StashContextMenuOpening"/> <EventSetter Event="ContextMenuOpening" Handler="StashContextMenuOpening"/>
</Style> </Style>
</ListView.ItemContainerStyle> </ListView.ItemContainerStyle>
@ -66,20 +65,10 @@
</DataTemplate> </DataTemplate>
</ListView.ItemTemplate> </ListView.ItemTemplate>
</ListView> </ListView>
</Grid>
<!-- Splitter --> <!-- Changed file toolbar -->
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/> <Border Grid.Row="2" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,1,0,1" SnapsToDevicePixels="True">
<Grid>
<!-- 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">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/> <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="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"/> <Label Grid.Column="1" Content="{StaticResource Text.Stashes.Changes.Tip}" Foreground="{StaticResource Brush.FG2}" FontSize="10"/>
</Grid> </Grid>
</Border>
<Rectangle Grid.Row="1" HorizontalAlignment="Stretch" Height="1" Fill="{StaticResource Brush.Border0}"/> <!-- Change files -->
<ListView <ListView
x:Name="changeList" x:Name="changeList"
Grid.Row="2" Grid.Row="3"
Background="{StaticResource Brush.Contents}" BorderThickness="0" Background="{StaticResource Brush.Contents}" BorderThickness="0"
Style="{StaticResource Style.ListView.Borderless}"
SelectedIndex="-1" SelectedIndex="-1"
ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"
@ -127,7 +117,6 @@
</ListView.ItemTemplate> </ListView.ItemTemplate>
</ListView> </ListView>
</Grid> </Grid>
</Grid>
<!-- Splitter --> <!-- Splitter -->
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/> <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>

View file

@ -29,26 +29,22 @@
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/> <ColumnDefinition Width="300"/>
<ColumnDefinition Width="1" MaxWidth="1"/> <ColumnDefinition Width="1"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!-- Left --> <!-- Left -->
<Grid Grid.Column="0"> <Grid Grid.Column="0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Unstaged changes -->
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="24"/> <RowDefinition Height="24"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </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> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
@ -58,8 +54,6 @@
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Border Grid.Column="0" Grid.ColumnSpan="6" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,0,1"/>
<local:FilesDisplayModeSwitch <local:FilesDisplayModeSwitch
Grid.Column="0" Grid.Column="0"
Mode="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Mode=TwoWay}"/> 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"/> <Path Width="14" Height="14" Data="{StaticResource Icon.DoubleDown}" Opacity=".4"/>
</Button> </Button>
</Grid> </Grid>
</Border>
<!-- Unstage changes tree view mode -->
<TreeView <TreeView
Grid.Row="1" Grid.Row="1"
x:Name="unstagedTree" x:Name="unstagedTree"
@ -134,8 +130,9 @@
</TreeView.ItemTemplate> </TreeView.ItemTemplate>
</TreeView> </TreeView>
<!-- Unstaged changes list/grid view mode -->
<DataGrid <DataGrid
Grid.Row="2" Grid.Row="1"
x:Name="unstagedList" x:Name="unstagedList"
ItemsSource="{Binding ElementName=me, Path=UnstagedListData, IsAsync=True}" ItemsSource="{Binding ElementName=me, Path=UnstagedListData, IsAsync=True}"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Converter={StaticResource FilesDisplayModeToList}}" Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Converter={StaticResource FilesDisplayModeToList}}"
@ -203,19 +200,10 @@
</Style> </Style>
</DataGrid.RowStyle> </DataGrid.RowStyle>
</DataGrid> </DataGrid>
</Grid>
<!-- Splitter --> <!-- Staged changes toolbar -->
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/> <Border Grid.Row="2" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,1,0,1" SnapsToDevicePixels="True">
<Grid>
<!-- Staged changes -->
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
@ -224,8 +212,6 @@
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Border Grid.Column="0" Grid.ColumnSpan="5" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,0,1"/>
<local:FilesDisplayModeSwitch <local:FilesDisplayModeSwitch
Grid.Column="0" Grid.Column="0"
Mode="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Mode=TwoWay}"/> 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"/> <Path Width="14" Height="14" Data="{StaticResource Icon.DoubleUp}" Opacity=".4"/>
</Button> </Button>
</Grid> </Grid>
</Border>
<!-- Staged changes tree view mode -->
<TreeView <TreeView
Grid.Row="1" Grid.Row="3"
x:Name="stageTree" x:Name="stageTree"
ItemsSource="{Binding ElementName=me, Path=StagedTreeData, IsAsync=False}" ItemsSource="{Binding ElementName=me, Path=StagedTreeData, IsAsync=False}"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToTree}}" Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToTree}}"
@ -294,7 +282,7 @@
</TreeView> </TreeView>
<DataGrid <DataGrid
Grid.Row="2" Grid.Row="3"
x:Name="stageList" x:Name="stageList"
ItemsSource="{Binding ElementName=me, Path=StagedListData, IsAsync=False}" ItemsSource="{Binding ElementName=me, Path=StagedListData, IsAsync=False}"
RowHeight="24" RowHeight="24"
@ -363,7 +351,6 @@
</DataGrid.RowStyle> </DataGrid.RowStyle>
</DataGrid> </DataGrid>
</Grid> </Grid>
</Grid>
<!-- Splitter --> <!-- Splitter -->
<GridSplitter Grid.Column="1" Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/> <GridSplitter Grid.Column="1" Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>