我正在尝试制作我的第一个应用程序,但我在网格方面遇到了一些问题。我试图将屏幕的左侧设为地图,将右侧设为 2 个框/网格。我不确定是否有办法在多个网格中拥有一个对象,或者如何设置这样的布局(基本上是一个+,左线消失了)
到目前为止,这是我获得的布局代码。
<Grid.RowDefinitions>
<RowDefinition Height= "*"/>
<RowDefinition Height= "*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Row="1">
<!-- map -->
</Grid>
您不能使一个元素“占据”多个网格,但可以通过设置使其跨越多个单元格Grid.RowSpan
or Grid.ColumnSpan
作为适当的。
e.g.
<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>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)