2015-06-17 67 views
0

我的shell窗口包含了從股票操盤RI演示應用WPF PRISM - 顯示在同一時間多個彈出視圖

infBehaviors:RegionPopupBehaviors.CreatePopupRegionWithName="{x:Static inf:RegionNames.SecondaryRegion}" 

我激活使用regionManager的RequestNavigate方法我的意見二次彈出區:

regionManager.RequestNavigate(RegionNames.SecondaryRegion, new Uri(FooView, UriKind.Relative)); 

一切工作正常,如果我只用一個視圖工作。但在我的情況下,我想一次擁有多個彈出式窗口 - 就像一次有多個彈出式窗口區域一樣。看起來問題在於激活/關閉區域內的視圖。

如何「說服」不要停用我以前的區域內的視圖?

有什麼想法?

回答

0

事實證明,解決方案比我預期的更容易。如果enybody需要這個解決方案。

我只是不得不修改RegionPopupBehaviours以使用AllActiveregion而不是原始的SingleActiveRegion,並且在DialogActivation中我不得不將第一次調用移除到CloseContentDialog。

希望是有幫助的。

+0

我也一樣,但在ContentDialogClosed的Region.Deactivate中得到一個異常。如果我也發表評論,如果我關閉彈出窗口,它永遠不會出現。我認爲解決方案是每次通過調用RegionPopupBehaviors中的RegisterNewPopupRegion來創建多個區域。如果你的解決方案的工作更簡單。除了上面提到的以外,還有其他的事情嗎? – asb

+0

您是否意味着您成功地同時顯示多個彈出窗口?你能提供更多的代碼嗎?你是怎麼做到的? –

0

我遇到了這個問題,我想我會擴展@ Sebastjan的帖子,因爲它可能會幫助某個人。

使用來自股票操盤RI演示代碼,在RegionPopupBehaviors類中,RegisterNewPopupRegion方法應該是這樣的:

public static void RegisterNewPopupRegion(DependencyObject owner, string regionName) 
    { 
     IRegionManager regionManager = ServiceLocator.Current.GetInstance<IRegionManager>(); 
     if (regionManager != null) 
     { 
      IRegion region = new AllActiveRegion(); //This was changed from SingleActiveRegion 
      DialogActivationBehavior behavior; 
      behavior = new WindowDialogActivationBehavior(); 
      behavior.HostControl = owner; 

      region.Behaviors.Add(DialogActivationBehavior.BehaviorKey, behavior); 
      regionManager.Regions.Add(regionName, region); 
     } 
    } 

對於任何人都沒有對股票交易者應用程序的代碼示例,你可以找到它here

相關問題