WPF: disable inheritance of properties

Posted by Maximilian Csuk on Stack Overflow See other posts from Stack Overflow or by Maximilian Csuk
Published on 2010-03-15T18:03:53Z Indexed on 2010/03/15 18:19 UTC
Read the original article Hit count: 707

Filed under:
|

Hi!

I would like to use a TabControl as the main navigation in the application I am working on. So I would like to make the font in the headers of the TabItems bigger and also give it another background-color. However, I do not want this to be inherited. For example, if I use this code:

<TabControl FontSize="18pt">
  <TabItem Header="Tab 1">
    <Button>Button 1</Button>
  </TabItem>
</TabControl>

The font in the button is also 18pt big. I know that this is normal dependency property behaviour because the property is inherited, but that's not what I want in this case. I would like to change the TabItems without changing anything in the children. Isn't that possible? Because re-setting all children to default values is a PITA.

Thanks for your time.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about dependency-properties