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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:12:27+00:00 2026-05-31T13:12:27+00:00

I have a user control that has a Title property bound to the Text

  • 0

I have a user control that has a Title property bound to the Text property of a TextBlock:

XAML

<TextBlock Grid.Column="0" Text="{Binding ElementName=me,Path=Title}" HorizontalAlignment="Left" VerticalAlignment="Top" />

Code behind

public String Title
{
    get { return (String)GetValue(TitleProperty); }
    set { SetValue(TitleProperty, value); }
}

public static readonly DependencyProperty TitleProperty =
    DependencyProperty.Register("Title", typeof(String), typeof(ClosableTabHeader), new UIPropertyMetadata(""));

And I wish to bind this Title property to another property on the main window:

XAML

<my:ClosableTabHeader Title="{Binding ElementName=me,Path=ShortenAmount}" />

Code behind

public Int32 ShortenAmount
{
    get { return (Int32)GetValue(ShortenAmountProperty); }
    set { SetValue(ShortenAmountProperty, value); }
}

public static readonly DependencyProperty ShortenAmountProperty =
    DependencyProperty.Register("ShortenAmount", typeof(Int32), typeof(MainWindow), new UIPropertyMetadata(0));

However, the textblock does not update.

When I replace the usercontrol declaration with a TextBlock, however, it works fine:

<TextBlock Text="{Binding ElementName=me,Path=ShortenAmount}" />

While there are certainly workarounds, in terms of what I am trying to do itself, may I know where I went wrong?

  • 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-31T13:12:28+00:00Added an answer on May 31, 2026 at 1:12 pm

    Problem lies in your ElementName. From your code my:ClosableTabHeader is not named as me. me looks like your MainWindow. But you are using me and Title together in this binding…

       <TextBlock Grid.Column="0" Text="{Binding ElementName=me,Path=Title}"  
                  HorizontalAlignment="Left" VerticalAlignment="Top" /> 
    

    where Title is property from ClosableTabHeader and not MainWindow (well MainWindow.Title exists as a inbuilt WPF property but I am sure we are not talking about it)

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

Sidebar

Related Questions

I have an abstract user control(baseModule) that has a property that I plan on
I have a user control that has a few public properties, one is an
I have a user control that contains a GridView. The GridView has both a
In my view I have this: <TextBlock Text={Binding Title}/> which binds to my ViewModel's
To explain confusing title, here is the deal. I have user control which has
I have a user control that has the following overridden event: protected override void
I have a user control that often has 2000 or so component controls (TextBoxes,
I have a user control that has a gridview in it with paging. The
I have a page that has a bunch of user controls on it. I
I have a complex page that has several user controls like galleries, maps, ads

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.