2009-07-22 56 views
0

如何獲得底部文本塊來填充剩餘空間的水平和垂直?如何獲得DockPanel使最後一項填充到底部和右側?

alt text http://i28.tinypic.com/ra5c1g.png

我已經得到了具有本地區一個shell:

<DockPanel Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" LastChildFill="True" 
Background="Orange"> 

    <ItemsControl x:Name="MainNavigationPanel" 
     Background="Yellow" 
     DockPanel.Dock="Left" 
     cal:RegionManager.RegionName="MainNavigationPanel" 
      Width="200" 
      HorizontalAlignment="Left"/> 


    <StackPanel x:Name="MainContent" 
     Background="Beige" 
     Width="Auto" 
     Height="Auto" 
     VerticalAlignment="Stretch" 
     HorizontalAlignment="Stretch" 
     > 
     <TextBlock Text="This will be the main region content."/> 
     </StackPanel> 

</DockPanel> 

而且在MainNavigationPanel我加載這樣的觀點:

<UserControl x:Class="MenuModule.Views.MainNavigationView" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:igOB="http://infragistics.com/OutlookBar" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    VerticalAlignment="Stretch" 
    HorizontalAlignment="Stretch"> 

    <DockPanel LastChildFill="True" 
     Background="Red" 
     HorizontalAlignment="Left" 
     VerticalAlignment="Stretch"> 

      <TextBlock Text="first" 
      DockPanel.Dock="Top" 
      Background="LightBlue" 
      VerticalAlignment="Stretch" 
      HorizontalAlignment="Stretch"/> 

      <TextBlock Text="second" 
      DockPanel.Dock="Bottom" 
      Background="LightGreen" 
      VerticalAlignment="Stretch" 
      HorizontalAlignment="Stretch"/> 

    </DockPanel> 

</UserControl> 

回答