I have several buttons, like this:
<Button Name="btnContent" Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
<Viewbox MaxWidth="100" StretchDirection="Both">
<TextBlock Text="Content" ></TextBlock>
</Viewbox>
</Button>
<Button Name="btnMoreContent" Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
<Viewbox MaxWidth="100" StretchDirection="Both">
<TextBlock Text="More Content" ></TextBlock>
</Viewbox>
</Button>
The font scales to fit the buttons. How can I grab the text size / scale value of the button with the smallest text at runtime and set them all to that size? I tried:
double FontSize = btnContentButton.FontSize;
if (FontSize < btnLongerContentButton.FontSize)
{
FontSize = btnLongerContentButton.FontSize;
}
btnContentButton.FontSize = FontSize;
btnLongerContentButton.FontSize = FontSize;
But this doesn't work, because I never actually changed the font size - It sets them all to 12.