在我的Shell.xaml中,我希望兩個模塊各佔用一半高度並可擴展。爲什麼第一個模塊被切斷?爲什麼我的模塊不能填充Shell.xaml中的完整DockPanel?
alt text http://i30.tinypic.com/2cr5zx0.png
外殼:
<Window x:Class="HelloWorld.Desktop.Shell"
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"
Height="300"
Width="300"
Title="Hello World" >
<DockPanel LastChildFill="True">
<ContentControl Name="MainRegion"
DockPanel.Dock="Top"
cal:RegionManager.RegionName="MainRegion"/>
<ContentControl
Name="SecondRegion"
DockPanel.Dock="Top"
cal:RegionManager.RegionName="SecondRegion"/>
</DockPanel>
</Window>
HelloWorldView:
<UserControl x:Class="HelloWorldModule.Views.HelloWorldView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel
Background="Tan">
<TextBlock Text="Hello World View"
Foreground="Brown"
Margin="10 10 10 0"
FontSize="14"/>
<TextBlock Name="DisplayArea"
Margin="10 10 10 0" Text="(default text)" TextWrapping="Wrap"/>
</StackPanel>
</UserControl>
SecondView:
<UserControl x:Class="SecondModule.Views.SecondView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel
Background="Orange">
<TextBlock Text="Second View"
Foreground="Brown"
Margin="10 10 10 0"
FontSize="14"/>
<TextBox Name="Message"
Margin="10 10 10 0" Text="skfddsf" TextChanged="TextBox_TextChanged"/>
</StackPanel>
</UserControl>
您實際上不需要Height =「5 *」中的5,只需在兩行中使用*即可。 – Carlo 2009-07-30 19:40:49