Table of Contents

Class RecipientViewModelBase

Namespace
Blazing.Mvvm.ComponentModel
Assembly
Blazing.Mvvm.Base.dll

Provides a base class for ViewModels that implement CommunityToolkit.Mvvm.ComponentModel.ObservableRecipient, supporting message reception and access to CommunityToolkit.Mvvm.Messaging.IMessenger. Implements IViewModelBase for Blazor MVVM lifecycle integration and IDisposable for resource cleanup.

public abstract class RecipientViewModelBase : ObservableRecipient, INotifyPropertyChanging, IViewModelBase, INotifyPropertyChanged, IDisposable

Inheritance

Derived

Implements

Inherited Members

Constructors

RecipientViewModelBase()

Initializes a new instance of the RecipientViewModelBase class and subscribes to command property changes.

protected RecipientViewModelBase()

RecipientViewModelBase(IMessenger)

Initializes a new instance of the RecipientViewModelBase class with the specified CommunityToolkit.Mvvm.Messaging.IMessenger and subscribes to command property changes.

protected RecipientViewModelBase(IMessenger messenger)

Parameters

messenger IMessenger

The messenger instance for message delivery.

Methods

CommandPropertyChanged(object?, PropertyChangedEventArgs)

Handles property changes for subscribed CommunityToolkit.Mvvm.Input.IAsyncRelayCommand instances.

protected virtual void CommandPropertyChanged(object? sender, PropertyChangedEventArgs e)

Parameters

sender object?

The command that raised the event.

e PropertyChangedEventArgs

The event data.

Dispose(bool)

Releases the unmanaged resources used by the RecipientViewModelBase and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

True to release both managed and unmanaged resources; false to release only unmanaged resources.

Dispose()

Disposes the ViewModel and releases resources.

public void Dispose()

NotifyStateChanged()

Notifies the View that its state has changed and a UI update may be required.

public virtual void NotifyStateChanged()

OnAfterRender(bool)

Invoked when the View has been rendered.

public virtual void OnAfterRender(bool firstRender)

Parameters

firstRender bool

Set to true if this is the first time the view is rendered; otherwise, false.

OnAfterRenderAsync(bool)

Asynchronously invoked when the View has been rendered.

public virtual Task OnAfterRenderAsync(bool firstRender)

Parameters

firstRender bool

Set to true if this is the first time the view is rendered; otherwise, false.

Returns

Task

A Task representing the asynchronous operation.

OnInitialized()

Invoked when the View is initialized and has received its initial parameters.

public virtual void OnInitialized()

OnInitializedAsync()

Asynchronously invoked when the View is initialized and has received its initial parameters.

public virtual Task OnInitializedAsync()

Returns

Task

A Task representing the asynchronous operation.

OnParametersSet()

Invoked when the View has received parameters from its parent and parameter values have been set.

public virtual void OnParametersSet()

OnParametersSetAsync()

Asynchronously invoked when the View has received parameters from its parent and parameter values have been set.

public virtual Task OnParametersSetAsync()

Returns

Task

A Task representing the asynchronous operation.

ShouldRender()

Determines whether the View should render.

public virtual bool ShouldRender()

Returns

bool

true if the View should render; otherwise, false.