EvgenOrel
EvgenOrel

Reputation: 139

wpf controls style Foreground inheritance from window

Why when i set property FontSize in window :

<Window x:Class= .....
    FontSize="16" >

it changing for all controls in window (for example in TextBox or Button) but, when i change Foreground="Green" is change nothing? Where can I find out more about such dependencies and get a list of them?

Upvotes: 0

Views: 28

Answers (1)

Clemens
Clemens

Reputation: 128061

It is caused by the FrameworkPropertyMetadata.Inherits flag, which is set on the FontSize dependency property.

Be aware that the flag is also set on the Foreground property, so the value of a Window's Foreground will be inherited by e.g. all TextBlocks child elements.


There is usually a Dependency Property Information section in the Remarks in the property documentation, that shows which FrameworkPropertyMetadata flags are set on a dependency property.

Upvotes: 1

Related Questions