Skip to content

Instantly share code, notes, and snippets.

@juucustodio
Created November 25, 2018 02:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save juucustodio/9e4e0f6836ba703320aeea775271fbe1 to your computer and use it in GitHub Desktop.
Example of how to use MessagingCenter in Xamarin.Forms applications. - https://julianocustodio.com/messagingcenter
using System;
using Xamarin.Forms;
namespace DemoMessagingCenter
{
public partial class AddPage : ContentPage
{
public AddPage()
{
InitializeComponent();
}
void Button_Clicked(object sender, System.EventArgs e)
{
if (!String.IsNullOrWhiteSpace(EntryItem.Text))
{
MessagingCenter.Send(new Message { Title = "New Item", Value = EntryItem.Text }, "AddItem");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment