ListView Delete Context Action

Hello,

I'm having a hard-time understanding what might have gone wrong with my implementation of a context action in one of my list views. I wanted to be able to delete item from a list view so this is what I've done:

in XAML:

<ViewCell.ContextActions>
    <MenuItem Text="Delete" Command="{Binding DeleteCommand}" IsDestructive="true" />
</ViewCell.ContextActions>

in VM:

public Command DeleteCommand { get; }

public Constructor()
{
    DeleteCommand = new Command(async () => await ExecuteDeleteCommand());
}

async Task ExecuteDeleteCommand()
{
    // task that ends up removing the item from it's table in azure db;
}

Now, I've got like four different Commands on this page. Three of them work. The fourth is this delete command and the problem is somewhere between clicking the delete button and executing the task, because it literally does nothing. The app doesn't have the problem rendering the context actions - the red delete button is visible on iOS after swiping the item however, when I click it - nothing happens. The task isn't executed. No breakpoint inside it is reached.

Normally I would expect something with the Binding Context, however all the other binding on the page work perfectly... so what could cause this problem?

Best Answer

Answers

Sign In or Register to comment.