PBe*_*ger 6 c# wpf layout user-controls .net-3.5
在WPF中,我想创建一个如下所示的Window:
用户控件的应用程序http://www.freeimagehosting.net/uploads/86209e1a87.png
在屏幕上有四个用户控件,#1,2,3,4.如您所见,用户控件2不应该呈现为框,而是内联.
如果这是一个WPF流文档:
原因是2可以在另一种形式中使用而不会分裂为3.
你知道如何以适当的方式做到这一点吗?
一些想法已经考虑过:
还有一些不那么干净......
有什么想法吗 ?
谢谢,
帕特里克
我认为你的表格被错误地分解了,IMO。
区域 2 不应包括您所描述的想要“内联”的底部部分。
它应该是分开的(就布局而言),并且可能适合包含 2 列和 2 行以及区域 3 和区域 4 的网格。区域 3 需要有 2 的行距。
在这种情况下,如果这样做的话,XAML 实际上会非常干净。
它可能看起来像这样:
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<uC:Area1 Grid.Row="0"><!-- Area Control here --></uC:Area1>
<uC:Area2 Grid.Row="1"><!-- Area Control here --></uC:Area2>
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<uC:AreaDuree Grid.Row="0" Grid.Column="0">
<!-- Area Control here -->
</uC:AreaDuree>
<uC:Area4 Grid.Row="1" Grid.Column="0">
<!-- Area Control here -->
</uC:Area4>
<uC:Area3 Grid.RowSpan="2" Grid.Column="1">
<!-- Area Control here -->
</uC:Area3>
</Grid>
</Grid>
Run Code Online (Sandbox Code Playgroud)