views:

112

answers:

0

If I have the following style defined:

<UserControl.Resources>
    <Style TargetType="TextBlock" x:Key="ProblemStyle">
        <Setter Property="FontSize" Value="40"/>
        <Setter Property="FontWeight" Value="Bold"/>
    </Style>
</UserControl.Resources>

Then when I have a ContentPresenter data bound to a string, in WPF I can get it to style the text as required with the following XAML:

<ContentPresenter Content="{Binding Problem}">
    <ContentPresenter.Resources>
        <Style TargetType="TextBlock" BasedOn="{StaticResource ProblemStyle}" />
    </ContentPresenter.Resources>
</ContentPresenter>

However, in Silverlight, this doesn't work. Is there a way that works for both?