2009-07-22 3 views
0

残りのスペースを水平および垂直に塗りつぶすにはどのようにしてボトムテキストブロックを取得しますか?DockPanelで最後の項目を一番下と右に塗りつぶす方法を教えてください。

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

私は、この領域を有するシェルを持っている:

<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> 

答えて

2

Dockpanelは自動的に記入されます残りのスペースは最後の項目がではありませんにはDockPanel.Dock添付プロパティが指定され、高さ/幅が指定されています。

私はここであなたのために提供されるサンプルはShell.Xamlで、この方法を示します。DockPanel on MSDN

Looking for Prism example of Modules loading themselves into a menu

また、DockPanelのための「備考」セクションでMSDNのドキュメントでこの事実を見つけることができます

関連する問題