样式优化

This commit is contained in:
“hsc”
2026-08-27 13:37:06 +08:00
parent f46df16275
commit c41190aa33
6 changed files with 40 additions and 85 deletions
+8 -8
View File
@@ -15,41 +15,41 @@ namespace MainModule.ViewModels
private bool IsInitialized = false;
private string _expandedCellName = string.Empty;
#endregion
#region
public bool KeepAlive => true; // 保持存活
public string ExpandedCellName
{
get => _expandedCellName;
set => SetProperty(ref _expandedCellName, value);
}
#endregion
#region
public ICommand LoadedCommand { get; set; }
#endregion
public MainViewModel(IContainerProvider containerProvider) : base(containerProvider)
{
LoadedCommand = new DelegateCommand(OnLoaded);
_eventAggregator.GetEvent<ExpandViewEvent>().Subscribe(OnCellExpandRequested);
}
#region
private void OnLoaded()
{
if (IsInitialized) return;
for (int i = 1; i <= 9; i++)
for (int i = 1; i <= 3; i++)
{
var parameters = new NavigationParameters { { "Name", $"TestCell{i}" } };
_regionManager.RequestNavigate($"TestCell{i}", "ProtocolStartView", parameters);
}
IsInitialized = true;
}
// 不再物理搬迁视图,只需修改一个字符串属性 ExpandedCellName
// XAML 里每个单元的 Style.Triggers 会根据该值处理隐藏 / 跨越 3x3
// XAML 里每个单元的 Style.Triggers 会根据该值处理隐藏 / 跨越整行
private void OnCellExpandRequested(string cellName)
{
ExpandedCellName = cellName ?? string.Empty;