为什么我的wpf网格会忽略Grid.Row?

时间:2014-04-29 12:28:59

标签: c# wpf grid row

我有以下代码:

<Popup Name="enterNamePopup" Width="250"  Height="200" AllowsTransparency="True" Placement="Center"  IsOpen="true">
        <Grid Background="Aquamarine">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120" />
                <ColumnDefinition Width="120" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="7"/>
                <RowDefinition Height="20" />
                <RowDefinition Height="30" />
            </Grid.RowDefinitions>
            <TextBlock Name="PleaseEnterName" Foreground="Black"  Grid.Row="1" Text="Save as..." Grid.ColumnSpan="2" />
            <TextBox Name="ProjectNameTextBox" Visibility="Visible"   Grid.Row="2" Grid.ColumnSpan="2" />
         <Button Name="SaveProjectButton" Content="Save Project" Grid.Row="3"  Grid.Column="1"/>
            <Button Name="CancelButton" Content="Cancel"  Grid.Row="3" Grid.Column="2" />

        </Grid>
    </Popup> 

任何人都可以告诉我它为什么会这样  wrong 当我想要这样的东西  right!

1 个答案:

答案 0 :(得分:1)

您只有三个RowDefinition。它们将编号为0,1和2.任何大于2的行号都将进入第2行。