我有一个ViewBox,它有这个内容:
<Viewbox Grid.Row="0" Grid.Column="1" Grid.RowSpan="3" Stretch="Fill" >
<StackPanel Orientation="Vertical" >
<Label HorizontalAlignment="Center" Content="Latest Match" FontSize="10"/>
<TextBlock Background="WhiteSmoke" Width="300"/>
<TextBlock Background="WhiteSmoke" Margin="0,5,0,0" />
<TextBlock Background="WhiteSmoke" Margin="0,5,0,0" />
<TextBlock Background="WhiteSmoke" Margin="0,5,0,0" />
<TextBlock Background="WhiteSmoke" Margin="0,5,0,0" />
</StackPanel>
</Viewbox>
当我放大窗口时,我得到了这个:
如何查看文本最新匹配的宽度似乎是压缩的,如何解决这个文本没有宽度压缩?
答案 0 :(得分:1)
您必须为Viewbox的Stretch属性设置不同的值。 在你的情况下可能是统一的。
请参阅this link
答案 1 :(得分:0)
试用此代码:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Viewbox Grid.Row="0" Grid.Column="1" Grid.RowSpan="3" Stretch="Fill" >
<StackPanel Orientation="Vertical" >
<Label HorizontalAlignment="Center" Content="Latest Match" FontSize="10" />
<TextBlock Background="WhiteSmoke" Width="300"/>
<TextBlock Background="WhiteSmoke" Margin="0,5,0,0" />
<TextBlock Background="WhiteSmoke" Margin="0,5,0,0" />
<TextBlock Background="WhiteSmoke" Margin="0,5,0,0" />
<TextBlock Background="WhiteSmoke" Margin="0,5,0,0" />
</StackPanel>
</Viewbox>
</Grid>