I want to bind a series of TextBoxes in a grid into properties of an object which is itself another property in my ViewModel (the DataContext).
CurrentPerson
consists of Name
and Age
properties
Inside the ViewModel:
public Person CurrentPerson { get; set ... (with OnPropertyChanged)}
Xaml :
<TextBox Text="{Binding Name}" >
<TextBox Text="{Binding Age}" >
I wasn't sure on the approach to use, I set another DataContext in the grid scope, without any result, Also tried setting the source and path like Source=CurrentPerson, Path=Age again without any result, these were for trial and see if there would be any change or not.
How should I achieve this ?
See Question&Answers more detail:os