문제

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>
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top