Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 810815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:56:42+00:00 2026-05-15T00:56:42+00:00

I have got an error while trying to upgrade our large project to SL4.

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:56:43+00:00Added an answer on May 15, 2026 at 12:56 am

    Thanks to Wolf Schmidt (MSFT)’s posting on the http://www.silverlight.net forum, the issue has been identified, explained and potentially resolved as designed. According to him, Silverlight 4 will now consider Silverlight 3’s quasi-dynamic behaviour with regard to ControlTemplates in a stricter way, which results in an error in Silverlight 4 when the property does not exist for the TargetType of the ControlTemplate. What’s important to note is that when the TargetType is not specified on the ControlTemplate it defaults to TargetType=”Control”.

    The resolution to the issue is to specify a TargetType for the ControlTemplate such that the properties used in the template binding will resolve.

    Here’s an updated style with the TargetType specified for the 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>
    

    It would however be very usefull to developers if the IDE/intellisense could verify that the property specified in the TemplateBinding actually exists on the defaulted/specified TargetType of the ControlTemplate.

    Sourced from:
    – our forum discussions on Silverlight .NET: (not enough reputation to post >1 hyperlink)
    – my the MS Connect issue: https://connect.microsoft.com/VisualStudio/feedback/details/561183

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got this error when using Enterprise Library 3.1 May 2007 version. We
We have got a custom MembershipProvider in ASP.NET . Now there are 2 possible
We have got loads of options for php + MySQL + Apache combo... Which
I have got a python script which is creating an ODBC connection. The ODBC
I have got a C function in a static library, let's call it A,
I have got the following problem since the server has safe mode turned on,
I have got some code to load an assembly and get all types, which
I have got the following code from here to read an Excel file using
I have got a table in MS Access 2007 with 4 fields. Labour Cost
I have got two classes, one a subclass of the other (say Animal and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.