Show / Hide Table of Contents

Class ValueChangedEventArgs<TProperty>

Event arguments for an event fired when an object's properties are changed. Often used with SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>) and other overloads of that function.

Inheritance
Object
ValueChangedEventArgs<TProperty>
Namespace: SadRogue.Primitives
Assembly: TheSadRogue.Primitives.dll
Syntax
public class ValueChangedEventArgs<TProperty> : EventArgs
Type Parameters
Name Description
TProperty

Type of the property changed.

Remarks

It is fairly common to have an event that is fired when a property is changed; a common use case relative to 2D grids is objects that have a position and fire an event when that position changes. This class encapsulates a generic event argument for such occurrences.

In addition to implementing basic functionality for handling value changes, it also has the appropriate flags for implementing the concept of "handling" an event; if supported by the event, this allows one event handler to mark the event as "handled" and stop other event handlers from being run.

Constructors

ValueChangedEventArgs(TProperty, TProperty)

Constructor.

Declaration
public ValueChangedEventArgs(TProperty oldValue, TProperty newValue)
Parameters
Type Name Description
TProperty oldValue

Previous value of property.

TProperty newValue

New value of property.

Fields

NewValue

New value of property.

Declaration
public readonly TProperty NewValue
Field Value
Type Description
TProperty

OldValue

Previous value of property.

Declaration
public readonly TProperty OldValue
Field Value
Type Description
TProperty

Extension Methods

PropertyChangedEventHelpers.SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>)
PropertyChangedEventHelpers.SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>, EventHandler<ValueChangedEventArgs<TProperty>>)
In This Article
Back to top Generated by DocFX