OnChangedInvokeMethodAttribute?
Does the Community Toolkit have a feature that allows calling a method when a property changes, similar to Fody?
like this.
thanks
I know that partial methods can be used to implement a method call, but now there are multiple properties, and I don’t want to use the PropertyChanged += PropertyChanged event to handle them.
like this:
If SearchValue is an ObservableProperty, you can do:
[ObservableProperty]
private string? searchValue;
partial void OnSearchValueChanged(string? value)
{
SearchGame();
}
There are at least 4 partial methods available that can be used for every observable property. Before the change and after the change. Two of them have the value before and after.
If SearchGame() is another property to simply get notified that it got changed (it doesn't have to be an observable property), like a "fullName" property that should be updated when either observable property "firstName" or "lastName" gets changed, you can use the NotifyPropertyChangedFor attribute, with the name of the property to get notified it should be updated too.