1

I have a DataGrid with a row for each entry in a collection. Each entry has a "Delete" button (in a DataGridTemplateColumn). I have hooked that button up to a command in the entry's model, which fires an event listened to by its parent container, which removes the entry from its list. My question:

  • Is there a nicer way of doing this?
  • Is there a neat way I can get it to pop up a confirmation dialog without violating MVVM? If possible, I'd like to avoid passing around a Func<bool> checkBeforeDeleting
Smashery
  • 57,848
  • 30
  • 97
  • 128
  • possible duplicate of [How have you successfully implemented MessageBox.Show() functionality in MVVM?](http://stackoverflow.com/questions/1098023/how-have-you-successfully-implemented-messagebox-show-functionality-in-mvvm) – Dan J Oct 21 '14 at 15:07

1 Answers1

0

if you update the code in InitializeComponent() part as

this.BindingNavigatorName.DeleteItem = null

it'll work for you. You can now ask "sure to delete?" and program if yes, delete or not delete

Good luck