Hey All,
I have been able to set up a databinding to a property with the following code:
and in the code:
Now when I click a button I do the following:
Edit: More specifically, the textbox does not reflect the changes to the model.
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!
I have been able to set up a databinding to a property with the following code:
Code:
<TextBox x:Name="txtTextBox" Text="{Binding Path=NameFirst, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
Code:
profile = context.NewProfile(); profile.NameFirst = "My Name"; txtTextBox.DataContext = profile;
Code:
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!