【问题标题】:PRISM RequestNavigate is not workingPRISM RequestNavigate 不工作
【发布时间】:2017-03-13 21:45:10
【问题描述】:

我正在使用 PRISM 并且在 XAML MainWindowView 中有 2 个区域:

<IG6:SplitPane IG6:XamDockManager.InitialLocation="DockedTop"> 
<IG6:TabGroupPane x:Name="MessageGroupPane" prism:RegionManager.RegionName="{x:Static inf:RegionNames.MessageGroupPane}">

<IG6:SplitPane IG6:XamDockManager.InitialLocation="DockedBottom"
<IG6:TabGroupPane x:Name="MainContentGroupPane"  prism:RegionManager.RegionName="{x:Static inf:RegionNames.MainContentGroupPane}">   

public class InfrastructureModule : IModule
{
    container.RegisterType<IMessageViewVM, MessageViewVM>();
    container.RegisterType<object, MessageView>("MessageView");
    regionManager.RegisterViewWithRegion(RegionNames.MessageGroupPane, typeof(MessageView));
}

当代码执行时,所有视图都放置在 XAML 中标识的最后一个 tabGroupPane 中——在本例中为 MainContentGroupPane——而不是在请求的区域 MessageGroupPane 中。

我正在使用 Brian Lagunas 提供的示例中的 TabGroupPaneRegionActiveAwareBehavior。视图显示正确,但我无法将它们放置在特定区域。有人能指出我正确的方向吗?

【问题讨论】:

  • 只是问显而易见的问题,但您是否仔细检查过您的 RegionNames 常量没有搞砸?我的意思是 RegionNames.MessageGroupPane 应该是什么? (有时复制粘贴会导致拼写错误:)
  • 您好 Jinish,我使用常量作为区域名称。公共静态字符串 MessageGroupPane = "MessageGroupPane";

标签: c# wpf prism


【解决方案1】:

您应该在模块中注册目标视图TargetView 以进行导航:

    container.RegisterTypeForNavigation<TargetView>();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-07-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-03
    • 2021-12-07
    • 1970-01-01
    相关资源
    最近更新 更多