Hello,
Welcome to our Microsoft Q&A platform!
A simple method is to use Xamarin.Forms MessagingCenter to achieve this.
In your page, Subscribe message as follows(PersonCell
is my ViewCell):
public HomePage ()
{
InitializeComponent ();
MessagingCenter.Subscribe<PersonCell,object>(this, "AddItem", (obj, item) =>
{
//var newItem = item as VeggieViewModel;
});
}
In ViewCell, send message:
public partial class PersonCell : ViewCell
{
public PersonCell()
{
InitializeComponent();
object obj = new object();
MessagingCenter.Send(this, "AddItem", obj);
}
}
For more details, check: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/messaging-center
Best Regards,
Jessie Zhang
---
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.