How do i get a viewmodel object to remove itself from its containing observable Collecttion?

I am building an application that has a ObservableCollection containing a bunch of UserControls.  The usercontrols are added because of a DataTemplate.  The object actually added to the collection is an MVVM view Model obejct.  

My usercontrol has a button on it that when pressed should cause itself to be removed from the list.  Now i can Implement this as an event by calling a custom event in the in the usercontrol code behind and catching it in another list object derived from the ObservableCollection.  but i would like to know if i can get the same behavior through the use of a command attachted to that button.
kmitch62Asked:
Who is Participating?
 
kmitch62Connect With a Mentor Author Commented:
I got it.  simply created a new custom event in the ViewModel and updated the Observable list to catch the event when fired.

Had the command redirect to the method that raised the event then done.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.