views:

758

answers:

1

I want to build up styles in XAML, e.g.

<UserControl.Resources>
    <Style x:Key="MyStyle" TargetType="TextBlock">
        <Setter Property="Margin" Value="2,2,2,2" />
        <Setter Property="Foreground" Value="DarkRed" />
    </Style>
    <Style x:Key="MyBoldStyle" TargetType="TextBlock">
        <Setter Property="Style" Value="{StaticResource MyStyle}" />
        <Setter Property="FontWeight" Value="Bold" />
    </Style>
</UserControl.Resources>

But this does not work. (In Silverlight 2) How can I make one inherit from the other?


June 2010 Update: Style Inheritance is in Silverlight 3, use BasedOn="{StaticResource MyStyle}

+2  A: 
Robert Claypool
Yes, it is coming in Silverlight 3 -- http://timheuer.com/blog/archive/2009/03/18/silverlight-3-whats-new-a-guide.aspx#element
Robert Claypool