主页的区域设置后可以默认选中
void CreateMenuBar()
{
MenuBars.Add(new MenuBar() { Icon = "Home", Title = "首页", NameSpace = "IndexView" });
MenuBars.Add(new MenuBar() { Icon = "Cog", Title = "设置", NameSpace = "SettingsView" });
}
/// <summary>
/// 配置首页初始化参数
/// </summary>
public void Configure()
{
regionManager.Regions[PrismManager.MainViewRegionName].RequestNavigate("IndexView");
}
但是进入二级页面后,再设置的区域无法默认选中
public class SettingsViewModel : BindableBase
{
public SettingsViewModel(IRegionManager regionManager)
{
MenuBars = new ObservableCollection<MenuBar>();
this.regionManager = regionManager;
NavigateCommand = new DelegateCommand<MenuBar>(Navigate);
CreateMenuBar();
//this.regionManager.Regions[PrismManager.SettingsViewRegionName].RequestNavigate("SettingsUserView");
}
private void Navigate(MenuBar obj)
{
if (obj == null || string.IsNullOrWhiteSpace(obj.NameSpace))
return;
regionManager.Regions[PrismManager.SettingsViewRegionName].RequestNavigate(obj.NameSpace);
}
public DelegateCommand<MenuBar> NavigateCommand { get; private set; }
private ObservableCollection<MenuBar> menuBars;
private readonly IRegionManager regionManager;
public ObservableCollection<MenuBar> MenuBars
{
get { return menuBars; }
set { menuBars = value; RaisePropertyChanged(); }
}
void CreateMenuBar()
{
MenuBars.Add(new MenuBar() { Icon = "Cog", Title = "系统设置", NameSpace = "SettingsUserView" });
MenuBars.Add(new MenuBar() { Icon = "Palette", Title = "个性化", NameSpace = "SkinView" });
MenuBars.Add(new MenuBar() { Icon = "Information", Title = "关于更多", NameSpace = "AboutView" });
}
使用this.regionManager.Regions[PrismManager.SettingsViewRegionName].RequestNavigate("SettingsUserView");
无法跳转,延迟执行也没用,请问这是什么原因?