Skip to content

⚙️EventAggregator provides multicast publish/subscribe functionality

Notifications You must be signed in to change notification settings

TBertuzzi/Xamarin.Forms.EventAggregator

Repository files navigation

Xamarin.Forms.EventAggregator

The EventAggregator provides multicast publish/subscribe functionality. This means there can be multiple publishers that raise the same event and there can be multiple subscribers listening to the same event.

This is the component, works on iOS, Android and UWP.

NuGet

Name Info
Xamarin.Forms.EventAggregator NuGet

Platform Support*

Xamarin.Forms.EventAggregator is a .NET Standard 2.0 library.Its only dependency is the Xamarin.Forms

Setup / Usage

Does not require additional configuration. Just install the package in the shared project and use.

Sample

Create a Sample Message

    public class TextMessage
    {
        public string Text { get; set; }
    }

Register Handler to listen to the event

  private void TextHandler(
    TextMessage message)
        {
            Text = message.Text;
        }
        
   //Register Event Handler
            EventAggregator.Instance.RegisterHandler<TextMessage>(
       TextHandler);

Send Message

   //Register Event
          
EventAggregator.Instance.SendMessage(TextMessage);

The complete example can be downloaded here: https://github.com/TBertuzzi/Xamarin.Forms.EventAggregator/tree/master/XamarinFormsEventAggregatorSample

About

⚙️EventAggregator provides multicast publish/subscribe functionality

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages