WPF Binding : Object in a object
- by Philippe
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 ?