2009-07-29 3 views
1

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

답변

1

대답 해주세요. 가변 행 높이의 격자을 사용했는데 효과가있었습니다.

<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="5*"/> 
     <RowDefinition Height="5*"/> 
    </Grid.RowDefinitions> 
    <ContentControl Name="MainRegion" 
        Grid.Row="0" 
      cal:RegionManager.RegionName="SecondRegion"/> 
    <ContentControl 
     Name="SecondRegion" 
        Grid.Row="1" 
     cal:RegionManager.RegionName="MainRegion"/> 
</Grid> 

이상한 그 StackPanel에DockPanel가 자동으로 동등하게 자신의 공간을 분할하지 않습니다하지만.

+0

Height = "5 *"의 5는 실제로 필요하지 않습니다. 두 행에서 *를 사용하십시오. – Carlo

0

StackPanel은 사용 가능한 공간을 채우기 위해 자식을 늘리지 않습니다 (기능 임).

LastChildFill="true"을 사용하면 DockPanel이 늘어납니다.

관련 문제