I am new to Xamarin.Forms and the concept of binding. Can someone please tell me why this is not working? The name of the object itself changes when I click the button. Why is not updating the text property?
var red = new Label { Text = todoItem.Name, BackgroundColor = Color.Red, Font = Font.SystemFontOfSize (20) }; red.SetBinding (Label.TextProperty, "Name"); Button button = new Button { Text = String.Format("Tap for name change!") }; button.Clicked += (sender, args) => { _todoItem.Name = "Namie " + new Random().NextDouble(); };
TodoItem is an object of the class below. The notification itself works, I'm pretty sure. I assume that something is wrong with my binding, or I missed something with this concept.
public class TodoItem : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; string _name; public string Name { get { return _name; } set { if (value.Equals(_name, StringComparison.Ordinal)) {
source share