ViewForMixins
trait · ferroui-reactiveui · v0.5.0
trait ViewForMixins
The activation of views (the extension members of IActivatableView in ViewForMixins),
for the shared handle of a view.
The activation of a view comes from the registered
IActivationForViewFetcher with the highest affinity for it; a view that no fetcher
handles panics (ArgumentException). While the view is active, the view model it shows (when
the view is an IViewFor) is activated too, when it is an IActivatableViewModel:
setting another view model deactivates the old one and activates the new one.
Upstream overloads WhenActivated on the shape of the block and on the extra arguments; here
each shape has a name:
| Upstream | Here |
|---|---|
WhenActivated(Func<IEnumerable<IDisposable>>) |
when_activated |
WhenActivated(Action<Action<IDisposable>>) |
when_activated_register |
WhenActivated(Action<ActivationDisposables>) |
when_activated_disposables |
WhenActivated() |
when_activated_empty |
the same with IViewFor? view |
..._for_view |
the same with IObservable<object?> viewModelChanged |
..._with_view_model_changed |
Each returns a disposable that ends the activation of the view and disposes what the block set up.
Members
when_activatedwhen_activated_for_viewwhen_activated_registerwhen_activated_register_for_viewwhen_activated_disposableswhen_activated_disposables_for_viewwhen_activated_emptywhen_activated_with_view_model_changedwhen_activated_register_with_view_model_changedwhen_activated_disposables_with_view_model_changedwhen_activated_empty_with_view_model_changedget_is_design_mode
when_activated
fn when_activated(self: &Self, block: impl Fn() -> Vec<Rc<dyn IDisposable>> + 'static) -> Rc<dyn IDisposable>
Runs block each time the view is activated; what it returns is disposed when the view
is deactivated (WhenActivated(Func<IEnumerable<IDisposable>>)).
when_activated_for_view
fn when_activated_for_view(self: &Self, block: impl Fn() -> Vec<Rc<dyn IDisposable>> + 'static, view: Option<Rc<dyn IViewFor>>) -> Rc<dyn IDisposable>
when_activated where the view model activated with the view is
the one of view rather than of this view (WhenActivated(Func<IEnumerable<IDisposable>>, IViewFor?)), for a view hosted apart from its view model.
when_activated_register
fn when_activated_register(self: &Self, block: impl Fn(&dyn Fn(Rc<dyn IDisposable>) -> ()) -> () + 'static) -> Rc<dyn IDisposable>
Runs block each time the view is activated; the block registers what to dispose on
deactivation with the function it is given (WhenActivated(Action<Action<IDisposable>>)).
when_activated_register_for_view
fn when_activated_register_for_view(self: &Self, block: impl Fn(&dyn Fn(Rc<dyn IDisposable>) -> ()) -> () + 'static, view: Option<Rc<dyn IViewFor>>) -> Rc<dyn IDisposable>
when_activated_register with the view whose view model
is activated (WhenActivated(Action<Action<IDisposable>>, IViewFor)).
when_activated_disposables
fn when_activated_disposables(self: &Self, block: impl Fn(&Rc<ActivationDisposables>) -> () + 'static) -> Rc<dyn IDisposable>
Runs block each time the view is activated with the ActivationDisposables that are
disposed on deactivation (WhenActivated(Action<ActivationDisposables>)).
when_activated_disposables_for_view
fn when_activated_disposables_for_view(self: &Self, block: impl Fn(&Rc<ActivationDisposables>) -> () + 'static, view: Option<Rc<dyn IViewFor>>) -> Rc<dyn IDisposable>
when_activated_disposables with the view whose view
model is activated (WhenActivated(Action<ActivationDisposables>, IViewFor?)).
when_activated_empty
fn when_activated_empty(self: &Self) -> Rc<dyn IDisposable>
Activates the view, and with it its view model, without a block of its own
(WhenActivated()).
when_activated_with_view_model_changed
fn when_activated_with_view_model_changed(self: &Self, block: impl Fn() -> Vec<Rc<dyn IDisposable>> + 'static, view_model_changed: Rc<dyn IObservable<ViewModelValue>>) -> Rc<dyn IDisposable>
when_activated, where the view model to activate is the latest
value of view_model_changed, which emits the current view model and every later one
(WhenActivated(Func<IEnumerable<IDisposable>>, IObservable<object?>)).
when_activated_register_with_view_model_changed
fn when_activated_register_with_view_model_changed(self: &Self, block: impl Fn(&dyn Fn(Rc<dyn IDisposable>) -> ()) -> () + 'static, view_model_changed: Rc<dyn IObservable<ViewModelValue>>) -> Rc<dyn IDisposable>
when_activated_register with the view model's changes
(WhenActivated(Action<Action<IDisposable>>, IObservable<object?>)).
when_activated_disposables_with_view_model_changed
fn when_activated_disposables_with_view_model_changed(self: &Self, block: impl Fn(&Rc<ActivationDisposables>) -> () + 'static, view_model_changed: Rc<dyn IObservable<ViewModelValue>>) -> Rc<dyn IDisposable>
when_activated_disposables with the view model's
changes (WhenActivated(Action<ActivationDisposables>, IObservable<object?>)).
when_activated_empty_with_view_model_changed
fn when_activated_empty_with_view_model_changed(self: &Self, view_model_changed: Rc<dyn IObservable<ViewModelValue>>) -> Rc<dyn IDisposable>
when_activated_empty with the view model's changes
(WhenActivated(IObservable<object?>)).
get_is_design_mode
fn get_is_design_mode(self: &Self) -> bool
Whether the view is being loaded by a designer (GetIsDesignMode()): false; the
integration of a toolkit can tell otherwise for its views.
Trait implementations
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.