tags:

views:

361

answers:

1

How can I change the font of all the child controls in a container, for example a Canvas? I want to have a slider so the user can control the font size of everything in the screen at once.

Thanks

+2  A: 

The FontSize property of the container should be inherited by child controls unless they explicitly override the property.

<Canvas TextElement.FontSize="20">
    <TextBlock>Sample Text</TextBlock>
</Canvas>

Some controls don't follow the normal inheritance mechanism, however. The ListBox and the Button do not inherit their Background setting from the parent, although they do inherit font properties.

alex
The property FontSize does not exist for Canvas, Grid, StackPanel, etc. What am I missing?Thanks
Gustavo Cavalcanti
Thanks a million! I didn't know attached properties could go down the tree.Thanks again Alex!
Gustavo Cavalcanti