gpt4 book ai didi

windows - 如何在通用 Windows 平台应用程序中实现

转载 作者:可可西里 更新时间:2023-11-01 11:49:48 25 4
gpt4 key购买 nike

如何在Windows Apps中使用Gird

I want to create a Login form. I have used grid and used but the Rows are not aligned properly, How can I do that?

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="67*"/>
<ColumnDefinition Width="293*"/>
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="Name" Height="32" Margin="0,0,0.333,0" ></TextBlock>
<TextBlock Text="Last Name" Height="30" Margin="0,0,0.333,0" ></TextBlock>
<TextBlock Text="Address"></TextBlock>
</StackPanel>
<StackPanel Grid.Column="1">
<TextBox></TextBox>
<TextBox></TextBox>
<TextBox></TextBox>
</StackPanel>
</Grid>

最佳答案

您应该在 Grid 中定义行和列。

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="67*"/>
<ColumnDefinition Width="293*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="45"></RowDefinition>
<RowDefinition Height="45"></RowDefinition>
<RowDefinition Height="45"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="Name" Grid.Column="0" Grid.Row="0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="Last Name" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="Address" Grid.Column="0" Grid.Row="2" VerticalAlignment="Center"></TextBlock>

<TextBox Grid.Column="1" Grid.Row="0" Height="30"></TextBox>
<TextBox Grid.Column="1" Grid.Row="1" Height="30"></TextBox>
<TextBox Grid.Column="1" Grid.Row="2" Height="30"></TextBox>
</Grid>

关于windows - 如何在通用 Windows 平台应用程序中实现 <Grid>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32880470/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com