https://github.com/tbertuzzi/xamarin.forms.eventaggregator
⚙️EventAggregator provides multicast publish/subscribe functionality
https://github.com/tbertuzzi/xamarin.forms.eventaggregator
event eventaggregator messagecenter xamarin xamarin-forms
Last synced: about 2 months ago
JSON representation
⚙️EventAggregator provides multicast publish/subscribe functionality
- Host: GitHub
- URL: https://github.com/tbertuzzi/xamarin.forms.eventaggregator
- Owner: TBertuzzi
- Created: 2021-11-23T16:47:54.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-11-23T17:38:37.000Z (over 3 years ago)
- Last Synced: 2025-04-15T07:43:42.608Z (about 2 months ago)
- Topics: event, eventaggregator, messagecenter, xamarin, xamarin-forms
- Language: C#
- Homepage:
- Size: 1.27 MB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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|[](https://www.nuget.org/packages/Xamarin.Forms.EventAggregator/)|*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
```csharp
public class TextMessage
{
public string Text { get; set; }
}
```Register Handler to listen to the event
```csharp
private void TextHandler(
TextMessage message)
{
Text = message.Text;
}
//Register Event Handler
EventAggregator.Instance.RegisterHandler(
TextHandler);
```Send Message
```csharp
//Register Event
EventAggregator.Instance.SendMessage(TextMessage);
```The complete example can be downloaded here: https://github.com/TBertuzzi/Xamarin.Forms.EventAggregator/tree/master/XamarinFormsEventAggregatorSample