hellow all, I have to bind an entity to wpf controls, also to bind it's nested object properties. it works fin until I try to create new object . then the nested object is not binded . I am using mvvm . the antities are detachad and came from wcf service. this is part of my xaml:
<Label Grid.Column="0" Grid.Row="0" Content="כתובת מגורים" />
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Path=Family.Address, Mode=TwoWay, UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" />
<Button Grid.Row="1" Padding="10" Command="{Binding SaveCommand}" Content="שמור" />
this is part of the VM:
void SaveExecute(object param)
{
if (!Globals.IsLocal)
{
ServiceReference1.ChildServiceClient proxy=new ServiceReference1.ChildServiceClient();
proxy.SaveChild(Child);
}
else
{
WcfServiceData.ChildService s=new WcfServiceData.ChildService();
s.SaveChild(Child);
}
//if (!context.Childs.Any(x=>x.IdentityNum==Child.IdentityNum ))
// context.Childs.AddObject(Child);
//context.SaveChanges();
}
void FindExecute(object param)
{
SearchState = Visibility.Visible;
}
//SearchCommand
void NewExecute(object param)
{
Child =new Child();
Child.Family=new Family();
Child.FamilyId= 0;
Child.Family.FamilyName="type name";
}
when the entity is old- all works and the changes saved successfully. but when the entity is new- even the text "type name" is not displayed.
any help ? thank you !!m.sh