固定配方顶栏提示位置并记录布局稳定约定
This commit is contained in:
parent
b242cee994
commit
27e757a4cb
@ -5,6 +5,11 @@
|
||||
- 每个可独立验证的小改动完成后,运行与改动相称的检查,通过后立即创建本地 Git 提交,并在回复中报告提交号。
|
||||
- 提交只包含本次工作涉及的文件,保留其他未关联修改;检查失败或工作尚未完成时,不把该步骤作为完成提交。
|
||||
|
||||
## 界面布局稳定性
|
||||
|
||||
- 保存结果、输入校验等会出现和消失的提示应使用固定尺寸的提示区,或放入独立浮层,避免提示变化导致其余控件位移、缩放或闪烁。
|
||||
- 单行提示超出可用宽度时省略显示,并提供悬停等方式查看完整内容。
|
||||
|
||||
## 中文代码注释(用户长期要求)
|
||||
|
||||
- 以后新增或修改项目代码时,必须同步补充或更新中文注释,将注释视为代码交付的一部分。
|
||||
|
||||
@ -85,18 +85,21 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- 配方名和操作按钮共用紧凑顶栏,提示仅在有内容时占用高度,余下空间留给编辑区。 -->
|
||||
<StackPanel Grid.Row="0" Margin="0,0,0,4">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<!-- 顶栏右侧为固定高度的单行提示区,长消息可通过悬停查看,提示变化不挤压编辑区。 -->
|
||||
<Grid Grid.Row="0" Margin="0,0,0,4" ColumnDefinitions="Auto,Auto,Auto,Auto,Auto,*">
|
||||
<TextBlock Text="{Binding Title}" Classes="Title" VerticalAlignment="Center" />
|
||||
<TextBlock Text="配方名" Width="NaN" Margin="12,0,8,0" Classes="Field" VerticalAlignment="Center" />
|
||||
<TextBox Width="220" VerticalAlignment="Center" IsEnabled="{Binding Recipe.CanEditFileName}" Text="{Binding Recipe.Name, Mode=TwoWay}" ToolTip.Tip="文件名和目录名自动使用配方名;已有配方名称固定" />
|
||||
<Button Content="保存" Command="{Binding SaveCommand}" Margin="8,0,0,0" Padding="10,3" VerticalAlignment="Center" Background="{StaticResource Panel}" BorderBrush="{StaticResource Accent}" />
|
||||
<Button Content="关闭" Command="{Binding CloseCommand}" Margin="6,0,0,0" Padding="10,3" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding NameValidationMessage}" IsVisible="{Binding NameValidationMessage, Converter={x:Static conv:StringConverters.IsNotNullOrEmpty}}" Foreground="#F0533C" TextWrapping="Wrap" Margin="0,3,0,0" />
|
||||
<TextBlock Text="{Binding SaveStatus}" IsVisible="{Binding SaveStatus, Converter={x:Static conv:StringConverters.IsNotNullOrEmpty}}" Foreground="{StaticResource Ok}" FontSize="12" TextWrapping="Wrap" Margin="0,3,0,0" />
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="1" Text="配方名" Width="NaN" Margin="12,0,8,0" Classes="Field" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="2" Width="220" VerticalAlignment="Center" IsEnabled="{Binding Recipe.CanEditFileName}" Text="{Binding Recipe.Name, Mode=TwoWay}" ToolTip.Tip="文件名和目录名自动使用配方名;已有配方名称固定" />
|
||||
<Button Grid.Column="3" Content="保存" Command="{Binding SaveCommand}" Margin="8,0,0,0" Padding="10,3" VerticalAlignment="Center" Background="{StaticResource Panel}" BorderBrush="{StaticResource Accent}" />
|
||||
<Button Grid.Column="4" Content="关闭" Command="{Binding CloseCommand}" Margin="6,0,0,0" Padding="10,3" VerticalAlignment="Center" />
|
||||
<Grid Grid.Column="5" Height="24" Margin="8,0,0,0" VerticalAlignment="Center">
|
||||
<!-- 配方名有错误时优先显示校验消息,两种提示复用同一位置。 -->
|
||||
<TextBlock Text="{Binding SaveStatus}" IsVisible="{Binding NameValidationMessage, Converter={x:Static conv:StringConverters.IsNullOrEmpty}}"
|
||||
Foreground="{StaticResource Ok}" FontSize="12" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" ToolTip.Tip="{Binding SaveStatus}" />
|
||||
<TextBlock Text="{Binding NameValidationMessage}" IsVisible="{Binding NameValidationMessage, Converter={x:Static conv:StringConverters.IsNotNullOrEmpty}}"
|
||||
Foreground="#F0533C" FontSize="12" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" ToolTip.Tip="{Binding NameValidationMessage}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<TabControl Grid.Row="1">
|
||||
<TabItem Header="步骤">
|
||||
<Grid Margin="10">
|
||||
|
||||
@ -1562,6 +1562,21 @@ internal static class Smoke
|
||||
Check(region.Color == $"#{chosen.R:X2}{chosen.G:X2}{chosen.B:X2}" && region.Brush.Color == chosen,
|
||||
"调色板选色更新配方中的颜色文本和区域预览");
|
||||
flyout.Hide();
|
||||
|
||||
// 比较提示出现与清除时的编辑区位置和尺寸,防止顶栏提示导致界面跳动。
|
||||
dialog.UpdateLayout();
|
||||
var editBounds = tabs.Bounds;
|
||||
var recipeName = model.Recipe.Name;
|
||||
model.Recipe.Name = "";
|
||||
dialog.UpdateLayout();
|
||||
Check(model.NameValidationMessage.Length > 0 && tabs.Bounds == editBounds, "配方名校验提示不改变编辑区布局");
|
||||
model.Recipe.Name = recipeName;
|
||||
model.SaveCommand.Execute();
|
||||
dialog.UpdateLayout();
|
||||
Check(model.SaveStatus.StartsWith("已保存") && tabs.Bounds == editBounds, "保存提示不改变编辑区布局");
|
||||
first.Name += "修改";
|
||||
dialog.UpdateLayout();
|
||||
Check(model.SaveStatus.Length == 0 && tabs.Bounds == editBounds, "清除保存提示不改变编辑区布局");
|
||||
}
|
||||
finally { await model.ShutdownAsync();dialog.Close(); }
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user