2016-12-05 9 views
0

stackPanelsを並べて配置したいと思います。各スタックパネルには、異なるコントロールがあります。今すぐ最初のスタックパネルが動作しています。テキストブロックとテキストボックスを持っています。今度は2番目のスタックパネルにボタンを追加したいと思います。問題は、2番目のパネルにボタンのコンテンツが表示されないことです。理由は分かりませんか?Stackpanels side by side

<StackPanel Orientation="Vertical"> 
    <StackPanel Orientation="Horizontal" Width="300" HorizontalAlignment="Left" Margin="10"> 
     <Grid> 
      <Grid.ColumnDefinitions> 
       <ColumnDefinition></ColumnDefinition> 
       <ColumnDefinition></ColumnDefinition> 
       <ColumnDefinition></ColumnDefinition> 
      </Grid.ColumnDefinitions> 
      <Grid.RowDefinitions> 
       <RowDefinition></RowDefinition> 
       <RowDefinition></RowDefinition> 
      </Grid.RowDefinitions> 
      <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left"> 
       <Grid> 
        <Grid.ColumnDefinitions> 
         <ColumnDefinition Width="100"></ColumnDefinition> 
         <ColumnDefinition Width="100"></ColumnDefinition> 
         <ColumnDefinition Width="100"></ColumnDefinition> 
        </Grid.ColumnDefinitions> 
        <Grid.RowDefinitions> 
         <RowDefinition Height="25"></RowDefinition> 
         <RowDefinition Height="25"></RowDefinition> 
        </Grid.RowDefinitions> 
        <TextBlock Grid.Column="0" Grid.Row="0" Text="Year" TextAlignment="Center"></TextBlock> 
        <TextBlock Grid.Column="1" Grid.Row="0" Text="Week" TextAlignment="Center"></TextBlock> 
        <TextBlock Grid.Column="2" Grid.Row="0" Text="File Location" TextAlignment="Center"></TextBlock> 
       </Grid> 
      </StackPanel> 
      <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="0" Margin="10"> 
       <Grid> 
        <Grid.ColumnDefinitions> 
         <ColumnDefinition></ColumnDefinition> 
         <ColumnDefinition Width="100"></ColumnDefinition> 
         <ColumnDefinition Width="100"></ColumnDefinition> 
        </Grid.ColumnDefinitions> 
        <Grid.RowDefinitions> 
         <RowDefinition Height="Auto"></RowDefinition> 
        </Grid.RowDefinitions> 
        <Button Grid.Column="0" Grid.Row="0"> 
         <TextBlock Text="Get Informations" TextWrapping="Wrap" TextAlignment="Center"></TextBlock> 
        </Button> 
       </Grid> 
      </StackPanel> 
      <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="0"></StackPanel> 
      <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="1"></StackPanel> 
      <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="1"></StackPanel> 
     </Grid> 

    </StackPanel> 
</StackPanel> 

答えて

1

ソリューションが必要な場合は、Stackpanelの幅を300に設定します。スタックパネルを削除するか、そのスタックパネル内のグリッドを30

+0

に修正してください。2つの内部並列スタックパネルのうちの2番目のパネルが切り取られます。 –

関連する問題