I have been able to set up a databinding to a property with the following code:
Expand|Select|Wrap|Line Numbers
- <TextBox x:Name="txtTextBox" Text="{Binding Path=NameFirst, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
Expand|Select|Wrap|Line Numbers
- profile = context.NewProfile();
- profile.NameFirst = "My Name";
- txtTextBox.DataContext = profile;
Expand|Select|Wrap|Line Numbers
- profile = context.NewProfile();
- profile.NameFirst = "Another name";
But the binding doesn't update. Is this because the WPF databinding is binding to the actual object? If that's the case, then when I point profile to the new Profile object, the old one is still being held in memory by the databinding?
Is there a way to make this work so that when I move profile, the databinding updates accordingly? I was hoping that it was bound to the variable not necessarily to the data of the variable.
Thanks!