有没有办法让一个对象在 Windows UA 中占用多个网格?
Is there a way I can have an object take up multiple grids in Windows UA?
我正在尝试制作我的第一个应用程序,但我在使用网格时遇到了一些问题。我正在尝试使屏幕左侧为地图,右侧为 2 boxes/grids。我不确定是否有办法在多个网格中放置一个对象,或者如何设置这样的布局(基本上是一个+,左边的线消失了)
到目前为止,这是我获得的布局代码。
<Grid.RowDefinitions>
<RowDefinition Height= "*"/>
<RowDefinition Height= "*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Row="1">
<!-- map -->
</Grid>
您不能使一个元素 "take up" 多个网格,但您可以通过适当设置 Grid.RowSpan
或 Grid.ColumnSpan
使其跨越多个单元格。
例如
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height= "*"/>
<RowDefinition Height= "*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Map will take up left hand side -->
<Map Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" />
<!-- top right -->
<Button Content="+" Grid.Column="1" Grid.Row="0" />
<!-- bottom right -->
<List Grid.Column="1" Grid.Row="1" />
</Grid>
我正在尝试制作我的第一个应用程序,但我在使用网格时遇到了一些问题。我正在尝试使屏幕左侧为地图,右侧为 2 boxes/grids。我不确定是否有办法在多个网格中放置一个对象,或者如何设置这样的布局(基本上是一个+,左边的线消失了)
到目前为止,这是我获得的布局代码。
<Grid.RowDefinitions>
<RowDefinition Height= "*"/>
<RowDefinition Height= "*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Row="1">
<!-- map -->
</Grid>
您不能使一个元素 "take up" 多个网格,但您可以通过适当设置 Grid.RowSpan
或 Grid.ColumnSpan
使其跨越多个单元格。
例如
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height= "*"/>
<RowDefinition Height= "*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Map will take up left hand side -->
<Map Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" />
<!-- top right -->
<Button Content="+" Grid.Column="1" Grid.Row="0" />
<!-- bottom right -->
<List Grid.Column="1" Grid.Row="1" />
</Grid>