locked
Binding Issues RRS feed

  • Question

  • Hi

    I am trying to bind a field using the Mode-TwoWay. I am getting an error TwoWay binding requires Path. Here is my code.

    CITVer.Text = auditHeader.AuditVersion.ToString();

    Binding myBinding = new Binding();

    myBinding.Source = auditHeader.AuditVersion;

    myBinding.Path =
    new PropertyPath (auditHeader.AuditVersion); myBinding.Mode = BindingMode.TwoWay;

    CITVer.SetBinding(TextBox.TextProperty, myBinding);

    Tuesday, July 6, 2010 12:35 PM

Answers

  • Thank you so much that worked. It has taking me a couple of days to get this to work.

    Tuesday, July 6, 2010 1:14 PM

All replies

  • Binding myBinding = new Binding();

    myBinding.Source = auditHeader.AuditVersion;

    myBinding.Path =
    new PropertyPath (auditHeader.AuditVersion); myBinding.Mode = BindingMode.TwoWay;

    CITVer.SetBinding(TextBox.TextProperty, myBinding);

     

    You are still not providing the Path or you did not set the Source right. The Path should be the FieldName in the Source, You are using the Source as Path. 

    What is  auditHeader.AuditVersion? If auditHeader is the Object and it has AuditVersion Field, you should set the Source = auditHeader, and set the Path = new PropertyPath ("AuditVersion");

     

    Tuesday, July 6, 2010 12:45 PM
  • Thank you so much that worked. It has taking me a couple of days to get this to work.

    Tuesday, July 6, 2010 1:14 PM