Class WinformsCreatesObservableForProperty
- Namespace
- ReactiveUI.Winforms
- Assembly
- ReactiveUI.Winforms.dll
WinForm view objects are not Generally Observableā¢, so hard-code some particularly useful types.
[RequiresDynamicCode("WinformsCreatesObservableForProperty uses methods that require dynamic code generation")]
[RequiresUnreferencedCode("WinformsCreatesObservableForProperty uses methods that may require unreferenced code")]
public class WinformsCreatesObservableForProperty : ICreatesObservableForProperty, IEnableLogger
- Inheritance
-
WinformsCreatesObservableForProperty
- Implements
-
IEnableLogger
- Extension Methods
Constructors
WinformsCreatesObservableForProperty()
public WinformsCreatesObservableForProperty()
Methods
GetAffinityForObject(Type, string, bool)
Returns a positive integer when this class supports GetNotificationForProperty for this particular Type. If the method isn't supported at all, return a non-positive integer. When multiple implementations return a positive value, the host will use the one which returns the highest value. When in doubt, return '2' or '0'.
[RequiresDynamicCode("GetAffinityForObject uses methods that require dynamic code generation")]
[RequiresUnreferencedCode("GetAffinityForObject uses methods that may require unreferenced code")]
public int GetAffinityForObject(Type type, string propertyName, bool beforeChanged = false)
Parameters
typeTypeThe type to query for.
propertyNamestringThe property of the type to query for.
beforeChangedboolIf true, returns whether GNFP is supported before a change occurs.
Returns
- int
A positive integer if GNFP is supported, zero or a negative value otherwise.
GetNotificationForProperty(object, Expression, string, bool, bool)
Subscribe to notifications on the specified property, given an object and a property name.
[RequiresDynamicCode("GetNotificationForProperty uses methods that require dynamic code generation")]
[RequiresUnreferencedCode("GetNotificationForProperty uses methods that may require unreferenced code")]
public IObservable<IObservedChange<object, object?>> GetNotificationForProperty(object sender, Expression expression, string propertyName, bool beforeChanged = false, bool suppressWarnings = false)
Parameters
senderobjectThe object to observe.
expressionExpressionThe expression on the object to observe. This will be either a MemberExpression or an IndexExpression depending on the property.
propertyNamestringThe property of the type to query for.
beforeChangedboolIf true, signal just before the property value actually changes. If false, signal after the property changes.
suppressWarningsboolIf true, no warnings should be logged.
Returns
- IObservable<IObservedChange<object, object>>
An IObservable which is signaled whenever the specified property on the object changes. If this cannot be done for a specified value of beforeChanged, return Observable.Never.