[英]ViewBox font not legible to minimum resolution
我正在使用ViewBox
在水平方向上显示标签列表并保持易读性,问题是当我将窗口缩小到设置为的最低分辨率时,出现了以下问题: 800
你怎么看我看不懂内容。 这种情况仅在窗口达到最小分辨率时出现,而在最大分辨率上时, ViewBox
运行情况相当好:
我不知道我做错了什么。 我从未使用过ViewBox
,这是我的代码:
<Viewbox TextOptions.TextFormattingMode="Display" Stretch="Uniform" Grid.Row="1" Grid.Column="1" Grid.RowSpan="1">
<StackPanel>
<Grid Margin="0, 1, 0, 0">
<Label Content="Foo" FontWeight="Bold"/>
<Label Content="{Binding Path = EventLeague}" HorizontalAlignment="Center"/>
</Grid>
<Grid Margin="0,-10, 0, 0">
<Label Content="Date" FontWeight="Bold"/>
<Label Content="{Binding Path = EventDate}" HorizontalAlignment="Center"/>
</Grid>
<Grid Margin="0,-10, 0, 0">
<Label Content="Week" FontWeight="Bold"/>
<Label Content="{Binding Path = EventGameWeek}" HorizontalAlignment="Center"/>
</Grid>
<Grid Margin="0,-10, 0, 0">
<Label Content="Home" FontWeight="Bold"/>
<Label Content="{Binding Path = EventStart}" HorizontalAlignment="Center"/>
</Grid>
<Grid Margin="0,-10, 0, 0">
<Label Content="Away" FontWeight="Bold"/>
<Label Content="{Binding Path = EventStadium}" HorizontalAlignment="Center"/>
</Grid>
</StackPanel>
</Viewbox>
您的网格没有行或列,这意味着一切都进入网格单元0,0彼此重叠
尝试这个
<Viewbox TextOptions.TextFormattingMode="Display" Stretch="Uniform" Grid.Row="1" Grid.Column="1" Grid.RowSpan="1" MinHeight="500" MinWidth="500" >
<UniformGrid Columns="2">
<Label Content="Foo" FontWeight="Bold"/>
<Label Content="{Binding Path = EventLeague}" HorizontalAlignment="Center"/>
<Label Content="Date" FontWeight="Bold"/>
<Label Content="{Binding Path = EventDate}" HorizontalAlignment="Center"/>
<Label Content="Week" FontWeight="Bold"/>
<Label Content="{Binding Path = EventGameWeek}" HorizontalAlignment="Center"/>
<Label Content="Home" FontWeight="Bold"/>
<Label Content="{Binding Path = EventStart}" HorizontalAlignment="Center"/>
<Label Content="Away" FontWeight="Bold"/>
<Label Content="{Binding Path = EventStadium}" HorizontalAlignment="Center"/>
</UniformGrid >
</Viewbox>
编辑:
正如您已经澄清的那样,大小是您的问题,而不是控件的可读性
那么视图框的工作方式是对其内部的内容执行图像拉伸以使其适合其中,
因此,如果ViewBox的宽度为100,但其中的项目的宽度为500,则它们会缩小到其原始大小的1/5以适合
因为您具有Stretch="Uniform"
那么它将在缩小和增长时保持纵横比,如果控件的尺寸太小,则可以设置Viewbox的MinHeight
和MinWidth
值来控制最小尺寸
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.