ferroui_system/component_model/i_notify_property_changed.rs
1use super::INotifyPropertyChanging;
2use crate::events::Event;
3
4/// Notifies clients that a property value of a model object (an object that
5/// is not part of the class hierarchy, such as a view model) has changed.
6///
7/// The event argument is the name of the property that changed; an empty
8/// name means that all properties of the object changed.
9pub trait INotifyPropertyChanged {
10 /// The event raised when a property value changes.
11 fn property_changed(&self) -> &Event<str>;
12
13 /// The object as [`INotifyPropertyChanging`], when it also raises the event of a property
14 /// that is about to change; `None` by default.
15 ///
16 /// An observer that holds the object as `INotifyPropertyChanged` uses this to find the
17 /// changing event, where .NET casts the object to the other interface.
18 fn as_notify_property_changing(&self) -> Option<&dyn INotifyPropertyChanging> {
19 None
20 }
21}