fix(desktop): 菜单贴紧标题栏,去掉顶部空隙

- 外层 Grid 不再加 18 边距:行 0 = Menu(Padding 10,3,0,3,紧贴标题栏),
  行 1 = 内容区(Margin 18,10,18,18),标题/查询卡改到内容区 Grid 的 row 0/1
- 原来的 Margin="-6,0,0,8" + Grid 18 边距会让菜单离标题栏多出 18px
This commit is contained in:
liufumingren 2026-10-17 18:16:03 +08:00
parent 21dfc7f651
commit e7ff6ed784

View File

@ -8,15 +8,15 @@
Background="{StaticResource BgBrush}" Background="{StaticResource BgBrush}"
FontFamily="Microsoft YaHei UI, Segoe UI" FontFamily="Microsoft YaHei UI, Segoe UI"
FontSize="13"> FontSize="13">
<Grid Margin="18"> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <!-- 菜单贴着标题栏(不留边距),菜单下才是带边距的内容区 -->
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- 菜单 --> <!-- 菜单 -->
<Menu Grid.Row="0" Margin="-6,0,0,8" Background="Transparent" BorderThickness="0"> <Menu Grid.Row="0" Padding="10,3,0,3" Background="Transparent" BorderThickness="0">
<MenuItem Header="工具(_T)"> <MenuItem Header="工具(_T)">
<MenuItem Header="测试查询" Click="FocusQuery_Click" /> <MenuItem Header="测试查询" Click="FocusQuery_Click" />
<Separator /> <Separator />
@ -39,8 +39,14 @@
</MenuItem> </MenuItem>
</Menu> </Menu>
<Grid Grid.Row="1" Margin="18,10,18,18">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- ① 标题 + 运行状态 + 当前登录用户 --> <!-- ① 标题 + 运行状态 + 当前登录用户 -->
<DockPanel Grid.Row="1" Margin="0,0,0,14"> <DockPanel Grid.Row="0" Margin="0,0,0,14">
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Center"> <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock x:Name="UserText" Text="未登录" Foreground="{StaticResource MutedBrush}" <TextBlock x:Name="UserText" Text="未登录" Foreground="{StaticResource MutedBrush}"
VerticalAlignment="Center" Margin="0,0,10,0" /> VerticalAlignment="Center" Margin="0,0,10,0" />
@ -56,7 +62,7 @@
</DockPanel> </DockPanel>
<!-- ② 查询测试(占满剩余高度;日志只写文件,界面上不再展示) --> <!-- ② 查询测试(占满剩余高度;日志只写文件,界面上不再展示) -->
<Border Grid.Row="2" Background="White" BorderBrush="{StaticResource LineBrush}" <Border Grid.Row="1" Background="White" BorderBrush="{StaticResource LineBrush}"
BorderThickness="1" CornerRadius="8" Padding="12,10"> BorderThickness="1" CornerRadius="8" Padding="12,10">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -77,4 +83,5 @@
</Grid> </Grid>
</Border> </Border>
</Grid> </Grid>
</Grid>
</Window> </Window>