Describe the bug
OnPropertyChanging is not called for a generated property when using the NotifyPropertyChangedFor attribute.
Steps to reproduce
Using this class:
public partial class MyObject : ObservableObject
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(FullName))]
private string name;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(FullName))]
private string surname;
public string FullName => $"{Name} {Surname}";
protected override void OnPropertyChanging(PropertyChangingEventArgs e)
{
base.OnPropertyChanging(e);
// This is never called for FullName
Debug.Assert(e.PropertyName != nameof(FullName));
}
}
The following code should cause OnPropertyChanging to be called for property FullName:
var o = new MyObject();
o.Name = "Jack";
Expected behavior
I expected OnPropertyChanging to be called also for property FulleName when Name is assigned a new value.
IDE and version
VS 2022
IDE version
17.2.12
Nuget packages
Nuget package version(s)
8.2.0
Help us help you
No, just wanted to report this
Describe the bug
OnPropertyChanging is not called for a generated property when using the NotifyPropertyChangedFor attribute.
Steps to reproduce
Using this class:
The following code should cause OnPropertyChanging to be called for property FullName:
Expected behavior
I expected
OnPropertyChangingto be called also for propertyFulleNamewhen Name is assigned a new value.IDE and version
VS 2022
IDE version
17.2.12
Nuget packages
Nuget package version(s)
8.2.0
Help us help you
No, just wanted to report this