4

私は次のようなシンプルなものを持っていWindowます:

<Window x:Class="StackOverflowExample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="3*" />
            <RowDefinition Height="2*" />
        </Grid.RowDefinitions>

        <Label Content="Foo" Margin="5" />
        <Label Grid.Row="1" Content="Bar" Margin="5" />
        <GridSplitter Grid.Row="1" Background="Black" VerticalAlignment="Top" Height="5" />
    </Grid>
</Window>

// The code-behind is empty, except for "InitializeComponent()".

ただし、アプリケーションを実行すると、何GridSplitterも表示されません。GridSplitter設計時もノーと見えます。

  • GridSplitterが正しい行にあることを確認し、をに設定しVerticalAlignmentましたTop
  • が混ざらないように、明示的な背景色を指定しGridSplitterました。
  • GridSplitterがの最後の要素であることを確認したGridので、問題が発生することはありませんZIndex
  • 念のため、ラベルに余白を追加して、グリッドを覆い隠さないようにしました(ただし、この場合は違いが生じるはずです)。

私は何が間違っているのですか?

4

1 に答える 1

6

設定する必要がありますHorizontalAlignment="Stretch"

<GridSplitter Grid.Row="1" Background="Black" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="5" />
于 2011-08-01T20:09:54.723 に答える