<Window x:Class="ColumnSpan_Check.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Rectangle Fill="Red" Grid.Column="0" Grid.ColumnSpan="1">
<Rectangle.Style>
<Style>
<Setter Property="Grid.ColumnSpan" Value="2"/>
</Style>
</Rectangle.Style>
</Rectangle>
</Grid>
</Window>
为什么不能在这里占用两列的矩形?当满足某个条件(使用数据触发器)时,我希望矩形占用两列,但问题是数据触发器被触发,但矩形的布局不会更新为占用两列。更新Grid.ColumnSpan不会更改矩形的列跨度
发布完整的XAML和DataContext代码。 –
你去我复制了整个XAML在这里 – GutterStink