You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assuming that this is a setting, other parts of the application might need to know when this setting is modified, i.e., it becomes dirty.
This is easily achieved using Messaging; however, it would require the developer to manually convert this field to a property with a backing field, defeating the purpose of the ObservableProperty attribute:
I believe an additional attribute that allows the developer to specify a callback method to be executed once the property is changed or even retrieved would be beneficial.
API breakdown
I'm not familiar enough with IIncrementalGenerator and the current CommunityToolkit.MVVM implementation to provide a useful API breakdown.
Currently, I've reserved to implement a custom generator using ISourceGenerator that finds an ObservablePropertyEx attribute to generate the necessary code with callback support.
Additional context
No response
Help us help you
No, just wanted to propose this
The text was updated successfully, but these errors were encountered:
I would like to have this feature too! Sometimes I have to reload some properties when another property has changed. A callback method within the setter would be great for this.
Overview
Assume that you are developing an observable model of a setting that contains a set of fields, decorated by the
ObservableProperty
attribute:Assuming that this is a setting, other parts of the application might need to know when this setting is modified, i.e., it becomes dirty.
This is easily achieved using Messaging; however, it would require the developer to manually convert this field to a property with a backing field, defeating the purpose of the
ObservableProperty
attribute:I believe an additional attribute that allows the developer to specify a callback method to be executed once the property is changed or even retrieved would be beneficial.
API breakdown
I'm not familiar enough with
IIncrementalGenerator
and the current CommunityToolkit.MVVM implementation to provide a useful API breakdown.However, I believe the generated code could utilize the
SetPropertyAndNotifyOnCompletion
method.Usage example
Breaking change?
I'm not sure
Alternatives
Currently, I've reserved to implement a custom generator using
ISourceGenerator
that finds anObservablePropertyEx
attribute to generate the necessary code with callback support.Additional context
No response
Help us help you
No, just wanted to propose this
The text was updated successfully, but these errors were encountered: