样式优化
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user