Skip to content

Add property change notification behaviors #270

Description

@kzu

Summary

Ship behaviors that raise INotifyPropertyChanging and INotifyPropertyChanged from property setters. Skip both events when the incoming value equals the current value.

API

The stunt implements the notify interfaces through the existing extra-interface arguments, Stunt.Of<T, T1..T8>. The behavior raises the events on that instance. It does not subscribe to anything.

Behavior

  • Only set_ accessors notify.
  • Raise PropertyChanging before next, and PropertyChanged after a successful set.
  • An equal value does not call next and does not raise either event. Compare with Equals.
  • A setter that throws does not raise PropertyChanged.

Acceptance

  • Assigning a new value raises Changing, then Changed, with the property name, and the setter runs once.
  • Assigning the current value raises neither event and does not call the setter.
  • Stunt.Of<T, INotifyPropertyChanged>() can be cast to INotifyPropertyChanged and observed.

Back this issue
Back this issue

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions