Pregunta

Im trying to define a style for a label control in Silverlight/XAML/C#.

Im new to this so please excuse my ignorance.

When I wrote the below code the IDE said theat Label Supported in a silverlight project

So how do I define a style type for this Label ?

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">


    ...
    <Style x:Key="TitleFontStyle" TargetType="sdk:Label"> 
        <Setter Property="Background" Value="{StaticResource ButtonBackgroundGradientBrush}" /> 

    </Style> 
</ResourceDictionary>
¿Fue útil?

Solución

It's because you dont have the sdk namespace referenced.

Include this:

xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"

at the top of your resource dictionary, then do a clean & rebuild and it should work

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top