我有一個基於棱鏡的應用程序。爲什麼ItemsControl會顯示一個視圖,但ContentControl什麼也不顯示?
這是我的外殼:
<Window x:Class="AvarioCRM3.ShellV2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cal="http://www.codeplex.com/CompositeWPF" >
<DockPanel LastChildFill="True">
<Border
Padding="10"
DockPanel.Dock="Top"
Background="#ddd">
<DockPanel>
<ItemsControl
Name="MainNavigationPanel"
cal:RegionManager.RegionName="MainNavigationPanel"
DockPanel.Dock="Top"/>
</DockPanel>
</Border>
</DockPanel>
</Window>
在我MenuModule我視圖添加到該區域,並精細顯示:
public void Initialize()
{
MainNavigationPresenter mainNavigationPresenter = this.container.Resolve<MainNavigationPresenter>();
IRegion mainRegion = this.regionManager.Regions["MainNavigationPanel"];
mainRegion.Add(new TestView());
}
的問題是:我不想要的ItemsControl在我的shell中,我想要一個ContentControl,但是當我使用ContentControl時,它什麼也沒有顯示。
爲什麼ItemsControl顯示我的視圖和ContentControl什麼也不顯示?
TestView將顯示,然後SecondTestView將被添加,然後異常可能會上升。如果沒有,那麼行爲就是你永遠不會看到SecondTestView。 – Rick 2009-07-23 15:43:09