Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of how to use MessagingCenter in Xamarin.Forms applications. - https://julianocustodio.com/messagingcenter
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Xamarin.Forms;
namespace DemoMessagingCenter
{
public partial class ListPage : ContentPage
{
ObservableCollection<string> list = new ObservableCollection<string>();
public ListPage()
{
InitializeComponent();
ListItem.ItemsSource = list;
MessagingCenter.Subscribe<Message>(this, "AddItem", message => {
list.Add(message.Value);
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment