Skip to main content

IMessenger.Register<TMessage>(Object, Object, Boolean, Action<TMessage>) Method

Registers a handler of a specific message type.

Namespace: DevExpress.Mvvm

Assembly: DevExpress.Mvvm.v23.2.dll

NuGet Packages: DevExpress.Mvvm, DevExpress.Win.Navigation

Declaration

void Register<TMessage>(
    object recipient,
    object token,
    bool receiveInheritedMessages,
    Action<TMessage> action
)

Parameters

Name Type Description
recipient Object

An object that will receive messages.

token Object

An object (marker) that can be used to identify a specific message. null if you want to process messages without tokens.

receiveInheritedMessages Boolean

true to receive messages of the TMessage type and all derived types; false to receive messages of the TMessage type only.

action Action<TMessage>

An action that will be invoked when the specified message occurs.

Type Parameters

Name
TMessage

Remarks

When sending a message, a token can be assigned to the message via the Send method’s parameter. Only message recipients that registered the same token via the Register method are invoked when this message occurs.

See Messenger to learn more.

See Also