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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:38:31+00:00 2026-06-13T09:38:31+00:00

I have problem with binding to dependency property of my new control. I decided

  • 0

I have problem with binding to dependency property of my new control.
I decided to write some tests to examine this issue.

Binding from TextBox.Text to another TextBox.Text

XAML code:

<TextBox Name="Test" Text="{Binding ElementName=Test2, Path=Text, UpdateSourceTrigger=PropertyChanged}" />
<TextBox Name="Test2" Grid.Row="2" />

The result is good – when I writing something in first TextBox -> second TextBox is updating (conversely too).

enter image description here

I created new control -> for example “SuperTextBox” with dependency property “SuperValue”.

Control XAML code:

<UserControl x:Class="WpfApplication2.SuperTextBox"
             ...
             Name="Root">
    <TextBox Text="{Binding SuperValue, ElementName=Root, UpdateSourceTrigger=PropertyChanged}" />
</UserControl>

Code behind:

public partial class SuperTextBox : UserControl
{
    public SuperTextBox()
    {
        InitializeComponent();
    }

    public static readonly DependencyProperty SuperValueProperty = DependencyProperty.Register(
        "SuperValue",
        typeof(string),
        typeof(SuperTextBox),
        new FrameworkPropertyMetadata(string.Empty)
    );

    public string SuperValue
    {
        get { return (string)GetValue(SuperValueProperty); }
        set { SetValue(SuperValueProperty, value); }
    }
}

Ok, and now tests!

Binding from TextBox.Text to SuperTextBox.SuperValue

    <TextBox x:Name="Test1" Text="{Binding ElementName=Test2, Path=SuperValue, UpdateSourceTrigger=PropertyChanged}" />
    <local:SuperTextBox x:Name="Test2" Grid.Row="2"/>

Test is correct too!
When I writing something in TextBox, SuperTextBox is updating.
When i writing in SuperTextBox, TextBox is updating.
All is ok!

Now a problem:
Binding from SuperTextBox.SuperValue to TextBox.Text

    <TextBox x:Name="Test1"/>
    <local:SuperTextBox x:Name="Test2" SuperValue="{Binding ElementName=Test1, Path=Text, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2"/>

In this case, when I writing something in SuperTextBox, TextBox is not updating!
enter image description here

How can I fix this?

PS: Question is very very long, I am sorry for that, but i tried exactly describe my problem.

  • 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-06-13T09:38:32+00:00Added an answer on June 13, 2026 at 9:38 am

    The reason why one works and the other doesn’t is because the Text dependency property of TextBox is defined to bind TwoWay by default, while your dependency property SuperValue isn’t. You need to use TwoWay-binding if you want the destination to update the source in addition to the source updating the destination.

    To fix this, you can add FrameworkPropertyMetadataOptions.BindsTwoWayByDefault to SuperValue's metadata like so:

    public static readonly DependencyProperty SuperValueProperty = DependencyProperty.Register(
        "SuperValue",
        typeof(string),
        typeof(SuperTextBox),
        new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with my Binding to a ListBox Control. Actually i have
I have a two way binding on a string dependency property to the Text
I have problem, the code below works fine, it creates a new Listbox control
I have a problem in binding JSON data to KENDO Pie Chart. I have
I have a problem with the binding of the below parameter. The connection works
We have an interesting problem with WCF binding and streaming transfer mode that we
The problem is basically this, in python's gobject and gtk bindings. Assume we have
I have a XAML view with a list box: <control:ListBoxScroll ItemSource={Binding Path=FooCollection} SelectedItem={Binding SelectedFoo,
I'm writing a user control with a dependency property for a search text called
I have implemented my own usercontrol based on listboxes. It has a dependency property

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.