Class IReactiveObjectExtensions
- Namespace
- ReactiveUI
- Assembly
- ReactiveUI.dll
Extension methods associated with the IReactiveObject interface.
- Inheritance
-
IReactive
Object Extensions
Methods
RaiseAndSetIfChanged<TObj, TRet>(TObj, ref TRet, TRet, string?)
RaiseAndSetIfChanged fully implements a Setter for a read-write property on a ReactiveObject, using CallerMemberName to raise the notification and the ref to the backing field to set the property.
public static TRet RaiseAndSetIfChanged<TObj, TRet>(this TObj reactiveObject, ref TRet backingField, TRet newValue, string? propertyName = null) where TObj : IReactiveObject
Parameters
reactiveObject
TObjThe Reactive
Object raising the notification.backingField
TRetA Reference to the backing field for this property.
newValue
TRetThe new value.
propertyName
stringThe name of the property, usually automatically provided through the CallerMemberName attribute.
Returns
- TRet
The newly set value, normally discarded.
Type Parameters
TObj
The type of the This.
TRet
The type of the return value.
RaisePropertyChanged<TSender>(TSender, string?)
Use this method in your ReactiveObject classes when creating custom properties where raiseAndSetIfChanged doesn't suffice.
public static void RaisePropertyChanged<TSender>(this TSender reactiveObject, string? propertyName = null) where TSender : IReactiveObject
Parameters
reactiveObject
TSenderThe instance of ReactiveObject on which the property has changed.
propertyName
stringA string representing the name of the property that has been changed. Leave
null
to let the runtime set to caller member name.
Type Parameters
TSender
The sender type.
RaisePropertyChanging<TSender>(TSender, string?)
Use this method in your ReactiveObject classes when creating custom properties where raiseAndSetIfChanged doesn't suffice.
public static void RaisePropertyChanging<TSender>(this TSender reactiveObject, string? propertyName = null) where TSender : IReactiveObject
Parameters
reactiveObject
TSenderThe instance of ReactiveObject on which the property has changed.
propertyName
stringA string representing the name of the property that has been changed. Leave
null
to let the runtime set to caller member name.
Type Parameters
TSender
The sender type.
SubscribePropertyChangedEvents<TSender>(TSender)
Use this method for enabling classic PropertyChanged events when you are implementing IReactiveObject manually.
public static void SubscribePropertyChangedEvents<TSender>(this TSender reactiveObject) where TSender : IReactiveObject
Parameters
reactiveObject
TSenderThe instance of IReactiveObject which should propagate property changes.
Type Parameters
TSender
The sender type.
SubscribePropertyChangingEvents<TSender>(TSender)
Use this method for enabling classic PropertyChanging events when you are implementing IReactiveObject manually.
public static void SubscribePropertyChangingEvents<TSender>(this TSender reactiveObject) where TSender : IReactiveObject
Parameters
reactiveObject
TSenderThe instance of IReactiveObject which should propagate property changes.
Type Parameters
TSender
The sender type.