0
votes

I'm trying to figure out how to change the font size of a textblock and textbox in Silverlight 2.0. in code behind. So far i've had no luck getting it done or find a referrence on how to do it.

thanks shannon

1

1 Answers

2
votes

You need to set the FontSize (also for TextBox) dependency property. This takes a double, as stated in MSDN:

A non-negative value that specifies the font size, measured in pixels. The default is 11.

To set this in code-behind, you can do something like this:

// Assuming you have a TextBlock called 'block'.
block.FontSize = 18;

// ...alternatively...
TextBlock.SetValue(TextBlock.FontSizeProperty, 18);