Implicit topic error: Content property was not found in type System.Windows.Controls.Control

I have an error while trying to upgrade our large project to SL4. I did not write the original topic, and my topic did not know. In my demo application, I have Label and LabelHeader (which I created and is just a derived class from Label with DefaultStyleKey = typeof (LabelHeader);
I create a LabelHeader as follows:

 <Style TargetType="themeControls:LabelHeader">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate>
                <DataInput:Label 
                    FontSize="{TemplateBinding FontSize}" 
                    FontFamily="{TemplateBinding FontFamily}" 
                    Foreground="{TemplateBinding Foreground}" 
                    Content="{TemplateBinding  Content}"/>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="FontFamily" Value="Tahoma"/>
    <Setter Property="FontSize" Value="20"/>
    <Setter Property="Foreground" Value="Red"/>
</Style>

This works in SL3, but in SL4 I get:

Error: Unhandled error in Silverlight application Code: 2500
Category: ParserError
Message: Content property not found in type System.Windows.Controls.Control.
File:
Line: 9
Position: 168

: Content = "{TemplateBinding Content}" Content = "XXX" , , , XXX , , XAML

, ?

- :

http://walkersretreat.co.nz/files/ThemeIssue.zip

( , : http://forums.silverlight.net/forums/p/183380/415930.aspx#415930)

EDIT. , . : https://connect.microsoft.com/VisualStudio/feedback/details/561183

, , !

+5
2

Wolf Schmidt (MSFT) www.silverlight.net , . , Silverlight 4 Silverlight 3 ControlTemplates , Silverlight 4, TargetType ControlTemplate. , TargetType ControlTemplate, TargetType = "Control".

, TargetType ControlTemplate , , , .

TargetType, ControlTemplate:

<Style x:Key="LabelHeader" TargetType="controls:Label">
    <Setter Property="Margin" Value="0" />
    <Setter Property="Opacity" Value=".6" />
    <Setter Property="VerticalAlignment" Value="Stretch" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="controls:Label">
                <Border BorderBrush="#CCCCCCCC" BorderThickness=".5" Background="#CCEFEFEF">
                    <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="2" Content="{TemplateBinding Content}"/>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

, IDE/intellisense , , TemplateBinding, / TargetType ControlTemplate.

:  - Silverlight.NET: ( > 1 )  - MS Connect: https://connect.microsoft.com/VisualStudio/feedback/details/561183

+6

Silverlight 4 , . .

, , Content.

Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}"

.

+4

All Articles