using Prism.Commands; using Prism.Mvvm; using Prism.Regions; using System.Collections.Generic; using System.Windows.Input; namespace RIZO.Client.MainModule.Models { public class MenuItemModel : BindableBase { public string MenuIcon { get; set; } public string MenuHeader { get; set; } public string TargetView { get; set; } private bool _isExpanded; public bool IsExpanded { get { return _isExpanded; } set { SetProperty(ref _isExpanded, value); } } public List Children { get; set; } public ICommand OpenViewCommand { get => new DelegateCommand(() => { if ((this.Children == null || this.Children.Count == 0) && !string.IsNullOrEmpty(this.TargetView)) { // 页面跳转 _regionManager.RequestNavigate("MainContentRegion", this.TargetView); } else this.IsExpanded = !this.IsExpanded; }); } IRegionManager _regionManager = null; public MenuItemModel(IRegionManager regionManager) { _regionManager = regionManager; } } }