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 597671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:18:20+00:00 2026-05-13T16:18:20+00:00

I need to an extra dependancy property to a control, so I’m overriding it.

  • 0

I need to an extra dependancy property to a control, so I’m overriding it. I.E.:

namespace Custom_TextBlock_Sample
{
  public class CustomLabel: Label
  {

  }
}

But I seem to be unable to add it to a DataTemplate. The following code will fail to build:

 ... xmlns:Custom_TextBlock_Sample="clr-namespace:Custom_TextBlock_Sample" ...

   <DataTemplate x:Key="Test">
      <Grid>
        <Custom_TextBlock_Sample:CustomLabel></Custom_TextBlock_Sample:CustomLabel>
      </Grid>
    </DataTemplate>

However inserting my overriden control anywhere else, (say not in the datatemplate) .. and compilation works no problem.

The following works: (My control is not nested in a date template).

  <Grid>
      <Custom_TextBlock_Sample:CustomLabel></Custom_TextBlock_Sample:CustomLabel>
  </Grid>

Also using a regular label in the Datatemplate also works:

<DataTemplate x:Key="Test">
  <Grid>
    <Label/>
  </Grid>
</DataTemplate>

Any ideas on what the issue might be ? Can I simply not add overridden controls to datatemplates in such a manor ? Is this a bug in Visual Studio 2007?

Note that since my intended changed to the control will be small, I simply want to override “Label” instead of wrapping it in a UserControl.

Thanks

  • 1 1 Answer
  • 2 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-13T16:18:21+00:00Added an answer on May 13, 2026 at 4:18 pm

    Ok, figured it out. This seems to be a namespace bug with Visual Studio. The problem fixed itself, when I started a new project from scratch, this time with no spaces in the project name and no “_” in namespaces names.

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

Sidebar

Related Questions

I need to some extra functionalities to a website regarding image handling. The user
I need to add extra validation to my DateField in Admin to make sure
I need someone to explain to me where this extra padding is coming from
I use a jquery validation plugin and I need to add some extra checking,
Using C#, I need to do some extra work if function A() was called
I found that using Smarty with PHP, sometimes extra time will need to be
im new to python gasp . im wondering do i need extra add-on module
Input string is something like this: OU=TEST:This001. We need extra This001. Best in C#.
Need a function that takes a character as a parameter and returns true if
Need a way to allow sorting except for last item with in a list.

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.