Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Unable to bind a ContextAction menuItem command to the viewModel.

$
0
0

I have a ListView with Textcells and have added TextCell.ContextActions with MenuItems. I have a Delete Menu item and bounf the command to a command in my view model which is hooked up to a method. However, the method is not being hit. Any ideas?

<ListView x:Name="lvNotes" ItemsSource="{Binding Notes}" IsVisible="{Binding PersonNotesVisible}" RowHeight="70"> <ListView.ItemTemplate> <DataTemplate> <TextCell Text="{Binding Title}" Detail="{Binding DateAdded}"> <TextCell.ContextActions> <MenuItem Text="Share"/> <MenuItem Command="{Binding DeleteNoteCommand}" CommandParameter="{Binding .}" Text="Delete" IsDestructive="True" /> </TextCell.ContextActions> </TextCell> </DataTemplate> </ListView.ItemTemplate> </ListView>

In the VIEWMODEL, I have initiated the DeleteNoteCommand in the VM constructor

public ICommand DeleteNoteCommand { get; set; }
DeleteNoteCommand = new Command(DeleteAction);

    private void DeleteAction(object obj)
        {

        }

Viewing all articles
Browse latest Browse all 204402

Trending Articles