Class ReactiveProperty<T>
- Namespace
- ReactiveUI
- Assembly
- ReactiveUI.dll
ReactiveProperty - a two way bindable declarative observable property with imperative get set.
[DataContract]
public class ReactiveProperty<T> : ReactiveObject, IReactiveNotifyPropertyChanged<IReactiveObject>, IHandleObservableErrors, IReactiveObject, INotifyPropertyChanging, IEnableLogger, IReactiveProperty<T>, IObservable<T?>, ICancelable, IDisposable, INotifyDataErrorInfo, INotifyPropertyChanged
Type Parameters
T
The type of the property.
- Inheritance
-
ReactiveProperty<T>
- Implements
-
IObservable<T>ICancelable
- Inherited Members
- Extension Methods
Constructors
ReactiveProperty()
Initializes a new instance of the ReactiveProperty<T> class. The Value will be default(T). DistinctUntilChanged is true. Current Value is published on subscribe.
ReactiveProperty(T?)
Initializes a new instance of the ReactiveProperty<T> class. The Value will be initialValue. DistinctUntilChanged is true. Current Value is published on subscribe.
Parameters
initialValue
TThe initial value.
ReactiveProperty(T?, bool, bool)
Initializes a new instance of the ReactiveProperty<T> class.
public ReactiveProperty(T? initialValue, bool skipCurrentValueOnSubscribe, bool allowDuplicateValues)
Parameters
initialValue
TThe initial value.
skipCurrentValueOnSubscribe
boolif set to
true
[skip current value on subscribe].allowDuplicateValues
boolif set to
true
[allow duplicate concurrent values].
ReactiveProperty(T?, IScheduler?, bool, bool)
Initializes a new instance of the ReactiveProperty<T> class.
public ReactiveProperty(T? initialValue, IScheduler? scheduler, bool skipCurrentValueOnSubscribe, bool allowDuplicateValues)
Parameters
initialValue
TThe initial value.
scheduler
ISchedulerThe scheduler.
skipCurrentValueOnSubscribe
boolif set to
true
[skip current value on subscribe].allowDuplicateValues
boolif set to
true
[allow duplicate concurrent values].
Properties
HasErrors
Gets a value indicating whether this instance has errors.
Property Value
- bool
true
if this instance has errors; otherwise,false
.
IsDisposed
Gets a value indicating whether gets a value that indicates whether the object is disposed.
Property Value
ObserveErrorChanged
Gets the observe error changed.
Property Value
- IObservable<IEnumerable>
The observe error changed.
ObserveHasErrors
Gets the observe has errors.
Property Value
- IObservable<bool>
The observe has errors.
Value
Gets or sets the value.
Property Value
- T
The value.
Methods
AddValidationError(Func<IObservable<T?>, IObservable<IEnumerable?>>, bool)
Set INotifyDataErrorInfo's asynchronous validation, return value is self.
public ReactiveProperty<T> AddValidationError(Func<IObservable<T?>, IObservable<IEnumerable?>> validator, bool ignoreInitialError = false)
Parameters
validator
Func<IObservable<T>, IObservable<IEnumerable>>If success return IO<null>, failure return IO<IEnumerable>(Errors).
ignoreInitialError
boolif set to
true
[ignore initial error].
Returns
- Reactive
Property <T> Self.
AddValidationError(Func<IObservable<T?>, IObservable<string?>>, bool)
Set INotifyDataErrorInfo's asynchronous validation, return value is self.
public ReactiveProperty<T> AddValidationError(Func<IObservable<T?>, IObservable<string?>> validator, bool ignoreInitialError = false)
Parameters
validator
Func<IObservable<T>, IObservable<string>>If success return IO<null>, failure return IO<IEnumerable>(Errors).
ignoreInitialError
boolif set to
true
[ignore initial error].
Returns
- Reactive
Property <T> Self.
AddValidationError(Func<T?, IEnumerable?>, bool)
Set INotifyDataErrorInfo validation.
public ReactiveProperty<T> AddValidationError(Func<T?, IEnumerable?> validator, bool ignoreInitialError = false)
Parameters
validator
Func<T, IEnumerable>Validation logic.
ignoreInitialError
boolif set to
true
[ignore initial error].
Returns
- Reactive
Property <T> Self.
AddValidationError(Func<T?, string?>, bool)
Set INotifyDataErrorInfo validation.
public ReactiveProperty<T> AddValidationError(Func<T?, string?> validator, bool ignoreInitialError = false)
Parameters
validator
Func<T, string>Validation logic.
ignoreInitialError
boolif set to
true
[ignore initial error].
Returns
- Reactive
Property <T> Self.
AddValidationError(Func<T?, Task<IEnumerable?>>, bool)
Set INotifyDataErrorInfo's asynchronous validation.
public ReactiveProperty<T> AddValidationError(Func<T?, Task<IEnumerable?>> validator, bool ignoreInitialError = false)
Parameters
validator
Func<T, Task<IEnumerable>>Validation logic.
ignoreInitialError
boolif set to
true
[ignore initial error].
Returns
- Reactive
Property <T> Self.
AddValidationError(Func<T?, Task<string?>>, bool)
Set INotifyDataErrorInfo's asynchronous validation.
public ReactiveProperty<T> AddValidationError(Func<T?, Task<string?>> validator, bool ignoreInitialError = false)
Parameters
validator
Func<T, Task<string>>Validation logic.
ignoreInitialError
boolif set to
true
[ignore initial error].
Returns
- Reactive
Property <T> Self.
CheckValidation()
Check validation.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
Parameters
disposing
booltrue
to release both managed and unmanaged resources;false
to release only unmanaged resources.
GetErrors(string?)
Gets the errors.
Parameters
propertyName
stringName of the property.
Returns
- IEnumerable
A IEnumerable.
Refresh()
Invoke OnNext.
Subscribe(IObserver<T?>)
Notifies the provider that an observer is to receive notifications.
Parameters
observer
IObserver<T>The object that is to receive notifications.
Returns
- IDisposable
A reference to an interface that allows observers to stop receiving notifications before the provider has finished sending them.