首次提交:添加src文件夹代码
This commit is contained in:
58
Cowain.Bake.Main/Models/MenuItemModel.cs
Normal file
58
Cowain.Bake.Main/Models/MenuItemModel.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Cowain.Bake.Main.Models
|
||||
{
|
||||
public class MenuItemModel : BindableBase
|
||||
{
|
||||
public string MenuIcon { get; set; }
|
||||
public string MenuHeader { get; set; }
|
||||
public string HeaderName { get; set; }
|
||||
public string TargetView { get; set; }
|
||||
|
||||
private bool isExpanded;
|
||||
|
||||
public bool IsExpanded
|
||||
{
|
||||
get { return isExpanded; }
|
||||
set { SetProperty(ref isExpanded, value); }
|
||||
}
|
||||
|
||||
private bool isDefault;
|
||||
|
||||
public bool IsDefault
|
||||
{
|
||||
get { return isDefault; }
|
||||
set { SetProperty(ref isDefault, value); }
|
||||
}
|
||||
|
||||
public List<MenuItemModel> Children { get; set; }
|
||||
|
||||
public ICommand OpenViewCommand
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
{
|
||||
if ((this.Children == null || this.Children.Count == 0) &&
|
||||
!string.IsNullOrEmpty(this.TargetView))
|
||||
{
|
||||
// 页面跳转 使用IRegionManager.RequestNavigate()跳转到目标页面
|
||||
_regionManager.RequestNavigate("MainContentRegion", this.TargetView);
|
||||
}
|
||||
else
|
||||
this.IsExpanded = !this.IsExpanded;
|
||||
});
|
||||
}
|
||||
IRegionManager _regionManager = null;
|
||||
public MenuItemModel(IRegionManager regionManager)
|
||||
{
|
||||
_regionManager = regionManager;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user