是否有 RowSpan="All"在 WPF 中?
我在网格中的 3 行中创建了一个 GridSplitter
,如下所示:
<GridSplitter Grid.Row="0" Grid.Column="1" Background="Yellow"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Width="Auto" Height="Auto" ResizeDirection="Columns"
Grid.RowSpan="3" ...
但是,可以想象我可能会在稍后阶段向网格中添加另一行,而且我真的不想这样做返回并更新我所有的行跨度。
我的第一个猜测是 Grid.RowSpan="*",但这无法编译。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一个简单的解决方案:
A simple solution:
您可以绑定到 RowDefinitions.Count,但在手动添加行时需要更新绑定。
编辑:实际上只是半手动
XAML:
代码:
You can bind to the RowDefinitions.Count but would need to update the binding when adding rows manually.
Edit: Only semi-manually in fact
Xaml:
Code:
Grid
控件没有提供任何开箱即用的功能。可以想象,您可以实现MarkupExtension
或其他一些技巧来实现此目的。The
Grid
control provides nothing like this out of the box. It's conceivable that you could implement aMarkupExtension
or some other trickery to enable this.