Exemple #1
0
        // called whenever we interact with an item in our list (long press on Android, swipe on iOS, right click on Windows) and choose the "Remove" Menu button
        private async void OnMenuRemoveItem(object sender, EventArgs e)
        {
            // the sender is the MenuItem object which we defined in our XAML
            // we set its Clicked property to the name of this method in XAML instead of giving it a name and referencing it in C#
            var menuItem = sender as MenuItem;

            // We had bound the CommandParameter property to the current Item that's selected through {Binding .}
            // We cast it into an Item to access its properties
            var currentItem = menuItem.CommandParameter as Item;

            await TodoItemManager.RemoveItem(currentItem);
        }