# AbstractNotifyPropertyChanged

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-dynamic-data/binding/struct-abstractnotifypropertychanged/

**struct** · [`ferroui-dynamic-data`](/docs/0.5.0/api/ferroui-dynamic-data/) · v0.5.0

```rust
struct AbstractNotifyPropertyChanged
```

The base of an object that notifies the changes of its properties
(`AbstractNotifyPropertyChanged`).

Deviation (DEVIATIONS.md, DynamicData): upstream's abstract class is a part that a type embeds;
the type implements `INotifyPropertyChanged` by returning `property_changed`,
and its setters call `set_and_raise` with the property name that
`[CallerMemberName]` gives upstream (the PascalCase name of the getter, which `prop!` derives).

```
use ferroui_dynamic_data::binding::AbstractNotifyPropertyChanged;
use ferroui_system::component_model::INotifyPropertyChanged;
use ferroui_system::events::Event;
use std::cell::Cell;

#[derive(Default)]
struct Item { notify: AbstractNotifyPropertyChanged, age: Cell<i32> }
impl Item {
    fn age(&self) -> i32 { self.age.get() }
    fn set_age(&self, value: i32) { self.notify.set_and_raise(&self.age, value, "Age") }
}
impl INotifyPropertyChanged for Item {
    fn property_changed(&self) -> &Event<str> { self.notify.property_changed() }
}

let item = Item::default();
item.set_age(3);
assert_eq!(item.age(), 3);
```

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/abstract_notify_property_changed.rs#L50)

## Members

- [`new`](#function-new)
- [`property_changed`](#function-property_changed)
- [`on_property_changed`](#function-on_property_changed)
- [`set_and_raise`](#function-set_and_raise)
- [`set_and_raise_with`](#function-set_and_raise_with)
- [`suspend_notifications`](#function-suspend_notifications)

<a id="function-new"></a>

### new

```rust
fn new() -> Self
```

A part without handlers.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/abstract_notify_property_changed.rs#L71)

<a id="function-property_changed"></a>

### property_changed

```rust
fn property_changed(self: &Self) -> &Event<str>
```

The event raised when a property value has changed (`PropertyChanged`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/abstract_notify_property_changed.rs#L76)

<a id="function-on_property_changed"></a>

### on_property_changed

```rust
fn on_property_changed(self: &Self, property_name: &str)
```

Raises `PropertyChanged` for `property_name`; an empty name means every property
(`OnPropertyChanged(string? propertyName)`, where `null` is every property). Nothing is
raised while the notifications are suspended.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/abstract_notify_property_changed.rs#L83)

<a id="function-set_and_raise"></a>

### set_and_raise

```rust
fn set_and_raise<T: PartialEq>(self: &Self, field: &impl BackingField<T>, value: T, property_name: &str)
```

Assigns `value` to `field` and raises `PropertyChanged` for `property_name`, unless the
field already holds an equal value (`SetAndRaise<T>(ref T, T, string?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/abstract_notify_property_changed.rs#L96)

<a id="function-set_and_raise_with"></a>

### set_and_raise_with

```rust
fn set_and_raise_with<T>(self: &Self, field: &impl BackingField<T>, value: T, comparer: impl Fn(&T, &T) -> bool, property_name: &str)
```

`set_and_raise` with an equality comparer
(`SetAndRaise<T>(ref T, T, IEqualityComparer<T>?, string?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/abstract_notify_property_changed.rs#L102)

<a id="function-suspend_notifications"></a>

### suspend_notifications

```rust
fn suspend_notifications(self: &Self, invoke_property_changed_event_when_finished: bool) -> Rc<dyn IDisposable>
```

Suspends the notifications until the result is disposed; then, when
`invoke_property_changed_event_when_finished` is true, raises `PropertyChanged` for every
property (`SuspendNotifications(bool invokePropertyChangeEventWhenDisposed = true)`).

Deviation (DEVIATIONS.md, DynamicData): the reference checkout no longer has this member;
the earlier API marked it obsolete ("This never worked properly in the first place"). It is
ported from that API: the suspension is one flag, so the first disposal of nested
suspensions ends it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/abstract_notify_property_changed.rs#L118)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `Default`
- `Debug`
- [`INotifyPropertyChanged`](/docs/0.5.0/api/ferroui-base/data/model/use-inotifypropertychanged/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
