我建立一個演示應用程序來學習棱鏡4的導航功能的應用程序有兩個模塊 - 每一個有三種意見:棱鏡4:RequestNavigate()不工作
- 一個用戶控件與文本塊( 「歡迎到模塊A」)
- 甲RibbonTab(使用區域適配器),和
- 的Outlook風格任務按鈕(例如Outlook的郵件,日曆等)
殼牌有三個命名區域:「RibbonRegion」,「TaskB」 uttonRegion「和」WorkspaceRegion「。視圖加載到這些區域。爲了測試基本設置,我使用Prism Region Manager註冊了所有三個視圖,以便它們在啓動時加載,並且按預期工作。
接下來,我修改了安裝程序,以便在啓動時只加載任務按鈕。其他視圖只會根據請求加載,方法是單擊任務按鈕。我的模塊初始化是這樣的:
public void Initialize()
{
/* We register the Task Button with the Prism Task Button Region because we want it
* to be displayed immediately when the module is loaded, and for the lifetime of
* the application. */
// Register Task Button with Prism Region
m_RegionManager.RegisterViewWithRegion("TaskButtonRegion", typeof(ModuleATaskButton));
/* We register these objects with the Unity container because we don't want them
* instantiated until we navigate to this module. */
// Register View and Ribbon Tab as singletons with Unity container
m_Container.RegisterType(typeof(ModuleAView), "ModuleAView", new ContainerControlledLifetimeManager());
m_Container.RegisterType(typeof(ModuleARibbonTab), "ModuleARibbonTab", new ContainerControlledLifetimeManager());
}
當用戶點擊任務按鈕,它調用調用IRegionManager.RequestNavigate()
顯示視圖一個ICommand對象:
的命令被調用時任務按鈕被點擊,但我所得到的是這樣的:
的用戶控件加載顯然爲System.Object
,我懷疑RibbonTab加載的是相同的。我認爲問題出在我的RequestNavigate()
電話上,或者我在Unity中註冊。但我無法確定問題。
任何人都可以闡明發生了什麼嗎?謝謝你的幫助。
你介意檢查一下嗎? http://stackoverflow.com/questions/18309661/navigation-not-occurring – 2013-08-19 08:43:35