Hello,
Welcome to our Microsoft Q&A platform!
In UWP, if you need to bind the property to notify the UI when it changes, then inheriting the INotifyPropertyChanged interface is a necessary step.
It's just that there will be some changes in the way we write attributes. Your Model and _model properties are not related, you can try to write:
public class MyViewModel : ViewModelBase
{
private Model _model;
public Model Model
{
get => _model;
set
{
_model = value;
// OnPropertyChanged();
}
}
}
The same wording can be used on specific properties of Model:
public class Model : INotifyPropertyChanged
{
private string _property;
public string Property
{
get => _property;
set
{
_property = value;
OnPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged([CallerMemberName]string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
Thanks.