I have a Silverlight page that contains an ItemsControl. It looks something like this
-- Name Description [Add]
-- Thing1 The first thing [Edit] [Delete]
-- Thing2 The second thing [Edit] [Delete]
where [Edit]
, [Delete]
, and [Add]
are buttons.
Currently I'm binding the control to a collection of Thing
and using a template to display the properties, and bind to an Edit
Command in my ViewModel.
It doesn't make sense (to me) for the ThingViewModel
to have a Delete
Command which causes it to delete itself;
- doesn't seem clean
- the Thing doesn't know that it is in a collection so can't remove itself from the collection
So what's the best pattern to wire up the [Delete]
button?