MessagingCenter.IMessagingCenter.Subscribe Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
IMessagingCenter.Subscribe<TSender,TArgs>(Object, String, Action<TSender,TArgs>, TSender) |
Subscribes to the specified |
IMessagingCenter.Subscribe<TSender>(Object, String, Action<TSender>, TSender) |
Subscribes to the specified |
IMessagingCenter.Subscribe<TSender,TArgs>(Object, String, Action<TSender,TArgs>, TSender)
Subscribes to the specified message
from the specified source
.
void IMessagingCenter.Subscribe<TSender,TArgs> (object subscriber, string message, Action<TSender,TArgs> callback, TSender source) where TSender : class;
abstract member Xamarin.Forms.IMessagingCenter.Subscribe : obj * string * Action<'Sender, 'Args (requires 'Sender : null)> * 'Sender -> unit (requires 'Sender : null)
override this.Xamarin.Forms.IMessagingCenter.Subscribe : obj * string * Action<'Sender, 'Args (requires 'Sender : null)> * 'Sender -> unit (requires 'Sender : null)
Type Parameters
- TSender
The type of object that sends the message.
- TArgs
The type of the objects that are used as message arguments for the message.
Parameters
- subscriber
- System.Object
The object that is subscribing to the messages. Typically, this is specified with the this
keyword used within the subscribing object.
- message
- System.String
The message that will be sent to objects that are listening for the message from instances of type TSender
.
- callback
- System.Action<TSender,TArgs>
A callback, which takes the sender and arguments as parameters, that is run when the message is received by the subscriber.
- source
- TSender
The object that will send the messages.
Implements
Applies to
IMessagingCenter.Subscribe<TSender>(Object, String, Action<TSender>, TSender)
Subscribes to the specified message
from the specified source
.
void IMessagingCenter.Subscribe<TSender> (object subscriber, string message, Action<TSender> callback, TSender source) where TSender : class;
abstract member Xamarin.Forms.IMessagingCenter.Subscribe : obj * string * Action<'Sender (requires 'Sender : null)> * 'Sender -> unit (requires 'Sender : null)
override this.Xamarin.Forms.IMessagingCenter.Subscribe : obj * string * Action<'Sender (requires 'Sender : null)> * 'Sender -> unit (requires 'Sender : null)
Type Parameters
- TSender
The type of object that sends the message.
Parameters
- subscriber
- System.Object
The object that is subscribing to the messages. Typically, this is specified with the this
keyword used within the subscribing object.
- message
- System.String
The message to subscribe to from source
.
- callback
- System.Action<TSender>
A callback, which takes the sender and arguments as parameters, that is run when the message is received by the subscriber.
- source
- TSender
The object that will send the messages.