hey,
i m trying sice few days to remove an item from a databinded listbox while using the contectmenu toolkit.
the remove method ask me to insert the name of an item but i couldnt find it.
here is the function for adding the item
{
listObjetDevis.Add(new itemListBoxSave {
devis = tbCreerDevis.Text });
IsolatedStorageHelper.SaveObject("devis", listObjetDevis);
}
thx for help
Here’s a simple example of how to do this which you should be able to customize to your own project/needs.
Create a new DataBound application.
Add a reference to the toolkit.
Add the following to the XAML declaration of MainPage:
xmlns:toolkit=”clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit”
Change the ListBox.ItemTemplate to the following:
Add the following event handler to the code behind:
private void ContextMenuDeleteClick(object sender, RoutedEventArgs e) { App.ViewModel.Items.Remove((sender as MenuItem).DataContext as ItemViewModel); }