[wpf / xaml] How do I make the font size increase when a text block is resized
I have a text block in a frame that resizes when the form is resized but I'd like the text font to resize to fill the available area.
I have :-
Code:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Race Timer" Height="380" Width="571" Name="RaceTimerWindow">
<Grid>
<Button Content="Start" Height="48" HorizontalAlignment="Left"
Margin="12,279,0,12" Name="Button_Start"
VerticalAlignment="Bottom" Width="150" FontSize="20" />
<Button Content="Stop" Height="48" HorizontalAlignment="Right" Margin="378,279,12,12"
Name="Button_Stop" VerticalAlignment="Bottom" Width="150" FontSize="20" />
<Grid HorizontalAlignment="Stretch" Margin="12,12,12,85"
Name="Grid_TimeClock" VerticalAlignment="Stretch" Background="Black" >
<TextBlock HorizontalAlignment="Stretch" Margin="12,6,12,12" FontFamily="Arial" FontSize="64"
Name="ElapsedTimeDisplay" VerticalAlignment="Stretch" Background="Black"
Foreground="Gold" TextAlignment="Center" FontStretch="SemiExpanded">
<TextBlock.Text >
00:00:00
</TextBlock.Text>
</TextBlock>
</Grid>
</Grid>
</Window>
Re: [wpf / xaml] How do I make the font size increase when a text block is resized
If your ok with the font increasing well then a viewbox is what you want.
http://msdn.microsoft.com/en-us/libr...s.viewbox.aspx