mar*_*ith 10 wpf layout gridview wpf-controls
有没有办法在特定列中组合行?因此得到这样的东西(我目前在控件上使用rowspan,即Image但是有更好的方法吗?)
--------------------
| |--------|
| |--------|
| |--------|
| |--------|
| |--------|
--------------------
Run Code Online (Sandbox Code Playgroud)
我基本上使用这个代码
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="124" />
<ColumnDefinition Width="246*" />
</Grid.ColumnDefinitions>
Run Code Online (Sandbox Code Playgroud)
这给了我这样的东西(注意行也出现在第0列)
--------------------
|---------|--------|
|---------|--------|
|---------|--------|
|---------|--------|
|---------|--------|
--------------------
Run Code Online (Sandbox Code Playgroud)
现在我可以解决这个问题,例如,如果我想放置一个图像,我可以使用RowSpan,但是不可能设计一个没有行的列而其他列有行吗?
Ken*_*art 11
Grid控件无法实现这一点.行遍历所有列,列遍历所有行.正如您所发现的那样RowSpan,ColumnSpan允许您分别使控件跨越多行或多列.
另一个可能的解决方法是Grid在另一个中托管一个:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image/>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
</Grid>
</Grid>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14189 次 |
| 最近记录: |