WPF Binding : Object in a object

Posted by Philippe on Stack Overflow See other posts from Stack Overflow or by Philippe
Published on 2011-02-04T14:58:53Z Indexed on 2011/02/04 15:25 UTC
Read the original article Hit count: 261

Filed under:
|
|

I have a form in WPF with 2 textbox :

<TextBox Name="txtName" Text="{Binding Contact.Name}"/>
<TextBox Name="txtAddressNumber" Text="{Binding Contact.Address.Number}"/>

and I have 2 class :

public class ContactEntity
{
  public string Name {get;set;}
  public AddressEntity Address {get;set;}
}

public class AddressEntity
{
  public int Number {get;set}
}

The Name property binds fine. But the Number property of the Address object inside the Contact object does not binds. What I'm doing wrong ?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about xaml