我Textblock
在 Listbox Template 中使用。我想在哪里Textblock Size
改变Content Text
.
Small Text --> Large FontSize && Large Text --> Small font Size
使其填充到模板中。
由于 Letters 占用了不同的占用空间,我们如何实现这一点。
示例:“i”占用的空间比“w”少/大写字母占用的空间多于小写字母。
<StackPanel HorizontalAlignment="Left" Height="30" VerticalAlignment="Top" Width="74" Margin="355,101,0,0" Background="#FF139905">
<TextBlock TextWrapping="Wrap" Text="This is a test application" Foreground="Black" FontWeight="Bold" FontSize="12"/>
</StackPanel>
<StackPanel HorizontalAlignment="Left" Height="30" VerticalAlignment="Top" Width="74" Margin="355,155,0,0" Background="#FF0FAA00">
<TextBlock TextWrapping="Wrap" Text="This is a test " Foreground="Black" FontWeight="Bold" FontSize="13.333"/>
</StackPanel>
<StackPanel HorizontalAlignment="Left" Height="30" VerticalAlignment="Top" Width="74" Margin="355,204,0,0" Background="#FF0FAA00">
<TextBlock TextWrapping="Wrap" Text="test " Foreground="Black" FontWeight="Bold" FontSize="26.667"/>
</StackPanel>