I have searched the forums for a solution but none of the listed solutions have helped. I'm assuming my implementation is off but I don't understand what or why.
Using Xamarin forms I am trying to get a label to update when an object's data is changed.
Relevant Code:
public new event PropertyChangedEventHandler PropertyChanged;
protected new virtual void OnPropertyChanged(string propertyName)
{
System.Diagnostics.Debug.WriteLine ("Before");
if (PropertyChanged != null)
{
System.Diagnostics.Debug.WriteLine ("Fired");
PropertyChanged(this,
new PropertyChangedEventArgs(propertyName));
}
}
public string String {
set {
if (_data == value)
return;
_data = value;
OnPropertyChanged ( "String" ); }
get { return _data; }
}
public new View Content {
get {
label = new Label { Text = String };
label.SetBinding( Label.TextProperty, new Binding( "String" ) );
return label;}
}
Basically, "Before" is printed to the console, but "Fired" does not get printed. This means PropertyChanged is null, so PropertyChanged is not being firing.
What am I missing?