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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:47:22+00:00 2026-05-22T22:47:22+00:00

How to bind textbox text property, within datatemplate, to ContentControl Content property? (Without bindng

  • 0

How to bind textbox text property, within datatemplate, to ContentControl Content property?
(Without bindng via ElementName)

This is my code( that doesn’t work):

<Window.Resources>
    <DataTemplate x:Key="Temp">
       <TextBox TextWrapping="Wrap" Text="{TemplateBinding Content}" Height="20" Width="Auto"/>           
    </DataTemplate>
</Window.Resources>
<Grid>
    <ContentControl  ContentTemplate="{DynamicResource Temp}" Content="1"/>           
</Grid>
  • 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-22T22:47:23+00:00Added an answer on May 22, 2026 at 10:47 pm

    Use a relative source binding:

    Text="{Binding RelativeSource={RelativeSource AncestorType=ContentControl}, Path=Content}"
    

    Edit: I probably should note that, in terms of what the binding targets, this is equivalent to {Binding}, as the DataContext in the ContentTemplate is the Content.

    However binding directly to the DataContext will not propagate back to the source DataContext, hence the Content of the ContentControl would not change when when using this binding (or the two-way compliant variation {Binding .}, which changes absolutely nothing as far as I can tell).

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

Sidebar

Related Questions

How can I do this in XAML: PSEUDO-CODE: <TextBox Text={Binding Password} Type=Password/> so that
I need to bind a TextBox's Text to a property of a class that
I wanted to create a control with a TextBox and to bind TextBox.Text property
Normally we bind a textbox's Text property to a data-context's properties. The data-context can
I'm trying to get bind a textbox text property to an observable collection, and
I've been struggling to bind a TextBox.Text to some object's public property but unfortunately
The following code should bind the value property of the text box to the
How can i bind a Text property from a textBox to a Width of
I want to bind TextBox's Text property to FolderBrowser's SelectedPath property. But it's not
I am trying to bind the Text of a TextBox named 'txtImage' to an

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.