I have got an error while trying to upgrade our large project to SL4.
I didn't write the original theme and my theme knowlege isn't great.
In my demo app I have a Label and a LabelHeader(which i have created and is just a derived class from Label with DefaultStyleKey = typeof(LabelHeader);
I am styling the LabelHeader like this:
<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: The property 'Content' was not found in type 'System.Windows.Controls.Control'.
File:
Line: 9
Position: 168
If I change this: Content="{TemplateBinding Content}" to Content="XXX" Then there is no error but , of course, I get XXX in my label rather than the content I set in XAML on the page
Any ideas how I can get this working?
Demo project here:
http://walkersretreat.co.nz/files/ThemeIssue.zip
(Apologies for reposting, I have so far got no answers over here: http://forums.silverlight.net/forums/p/183380/415930.aspx#415930)
EDIT The answer provided looks like it will work. An issue has been opened for this issue here: https://connect.microsoft.com/VisualStudio/feedback/details/561183
vote if you think this is important!