IActivationForViewFetcher interface¶
Defined in
Namespace: ReactiveUI.Reactive
Assembly: ReactiveUI.Reactive.dll
Full name: ReactiveUI.Reactive.IActivationForViewFetcher
Modifiers: public abstract
Summary¶
Implement this interface to override how ReactiveUI determines when a
View is activated or deactivated. This is usually only used when porting
ReactiveUI to a new UI framework.
Applies to
net10.0, net10.0-ios26.0, net10.0-android36.0, net10.0-maccatalyst26.0, net10.0-tvos26.0, net10.0-macos26.0, net9.0, net8.0, net462, net481
Remarks¶
Activation fetchers translate framework-specific signals (such as page navigation, focus, or visibility
changes) into the cross-platform IActivatableView semantics used by ReactiveUI. Multiple
fetchers can exist, each advertising an affinity for a given view type.
Examples¶
<![CDATA[
public sealed class WinFormsActivationFetcher : IActivationForViewFetcher
{
public int GetAffinityForView(Type view) => typeof(Form).IsAssignableFrom(view) ? 10 : 0;
public IObservable<bool> GetActivationForView(IActivatableView view)
{
var form = (Form)view;
return Observable.Merge(
Observable.FromEventPattern(form, nameof(form.Load)).Select(_ => true),
Observable.FromEventPattern(form, nameof(form.FormClosed)).Select(_ => false));
}
}
]]>
Methods¶
| Name | Summary |
|---|---|
| GetAffinityForView | Determines the priority that the Activation View Fetcher will be able to process the view type. 0 means it cannot activate the View, value larger than 0 ... |
| GetActivationForView | Gets a Observable which will activate the View. This is called after the GetAffinityForView method. |