fix: the width of ConfigureWorkspace window sometimes tool small (#458)

This commit is contained in:
leo 2024-09-11 10:08:31 +08:00
parent f314da54aa
commit 9b47198229
No known key found for this signature in database
2 changed files with 15 additions and 6 deletions

View file

@ -93,8 +93,6 @@ namespace SourceGit.Views
base.Render(context); base.Render(context);
// Color table. // Color table.
var border = this.FindResource("Brush.Border0") as IBrush;
var pen = new Pen(border, 0.2);
{ {
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
@ -103,11 +101,22 @@ namespace SourceGit.Views
var idx = i * 8 + j; var idx = i * 8 + j;
var x = j * 32.0; var x = j * 32.0;
var y = i * 32.0; var y = i * 32.0;
context.DrawRectangle(new SolidColorBrush(COLOR_TABLE[i, j]), pen, new Rect(x, y, 32, 32)); context.FillRectangle(new SolidColorBrush(COLOR_TABLE[i, j]), new Rect(x, y, 32, 32));
if (idx == _hightlightedTableElement) if (idx == _hightlightedTableElement)
context.DrawRectangle(new Pen(Brushes.White, 2), new Rect(x + 2, y + 2, 28, 28)); context.DrawRectangle(new Pen(Brushes.White, 2), new Rect(x + 2, y + 2, 28, 28));
} }
} }
var border = this.FindResource("Brush.Border0") as IBrush;
var pen = new Pen(border, 0.4);
for (int i = 1; i < 6; i++)
{
for (int j = 1; j < 8; j++)
context.DrawLine(pen, new Point(j * 32, 0), new Point(j * 32, 192));
context.DrawLine(pen, new Point(0, i * 32), new Point(256, i * 32));
}
} }
// Palette picker // Palette picker

View file

@ -46,7 +46,7 @@
</Grid> </Grid>
<!-- BODY --> <!-- BODY -->
<Grid Grid.Row="1" ColumnDefinitions="200,*" Height="324" Margin="8"> <Grid Grid.Row="1" ColumnDefinitions="200,16,256" Height="324" Margin="8">
<Border Grid.Column="0" <Border Grid.Column="0"
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
Background="{DynamicResource Brush.Contents}"> Background="{DynamicResource Brush.Contents}">
@ -104,12 +104,12 @@
</Grid> </Grid>
</Border> </Border>
<ContentControl Grid.Column="1" Margin="16,0,0,0" Content="{Binding Selected}"> <ContentControl Grid.Column="2" Content="{Binding Selected}">
<ContentControl.DataTemplates> <ContentControl.DataTemplates>
<DataTemplate DataType="vm:Workspace"> <DataTemplate DataType="vm:Workspace">
<Grid RowDefinitions="Auto,Auto,Auto,Auto"> <Grid RowDefinitions="Auto,Auto,Auto,Auto">
<TextBlock Grid.Row="0" Text="{DynamicResource Text.ConfigureWorkspace.Name}"/> <TextBlock Grid.Row="0" Text="{DynamicResource Text.ConfigureWorkspace.Name}"/>
<TextBox Grid.Row="1" Margin="-4,4,0,0" CornerRadius="3" Height="28" Width="256" Text="{Binding Name, Mode=TwoWay}"/> <TextBox Grid.Row="1" Margin="0,4,0,0" CornerRadius="3" Height="28" Text="{Binding Name, Mode=TwoWay}"/>
<TextBlock Grid.Row="2" Margin="0,12,0,4" Text="{DynamicResource Text.ConfigureWorkspace.Color}"/> <TextBlock Grid.Row="2" Margin="0,12,0,4" Text="{DynamicResource Text.ConfigureWorkspace.Color}"/>
<v:ColorPicker Grid.Row="3" HorizontalAlignment="Left" Value="{Binding Color, Mode=TwoWay}"/> <v:ColorPicker Grid.Row="3" HorizontalAlignment="Left" Value="{Binding Color, Mode=TwoWay}"/>