Binding in code not working RRS feed

  • Question

  • Hello,









            public MainPage()
                Binding bd01 = new Binding();
                bd01.Source = tx01;
                bd01.Path = new PropertyPath("Text");
                tx02.SetBinding(TextBox.TextProperty, bd01);

    This is a simple Binding in code of two textBoxes.

    If you Change the text in tx01 TextBox the Text in tx02-TextBox should be the same.

    If I do the binding in xaml all works fine. (in code in wpf all works fine).

    Binding in Code in Windows runtime does not update the target.

    Thank you for any help.


    Monday, March 30, 2015 7:49 PM


  • Hello rowe10,

    The only reason I can think of that this wouldn't work is when you bind to the wrong control. From your code above, it appears you are binding to the wrong control. Notice your XAML has a different name than the code behind for both textboxes.

    I corrected the textbox names and was able to make changes as expected. I wasn't able to reproduce the issue you are reporting.

    Like I mentioned above, you might be binding to the wrong textbox control.

    Hope this works.

    Abdulwahab Suleiman

    • Marked as answer by rowe10 Tuesday, March 31, 2015 7:14 PM
    Monday, March 30, 2015 11:54 PM