I\'m trying to bind a command to a menuitem in WPF. I\'m using the same method that\'s been working for all my other command bindings, but I can\'t figure out why it doesn\'
ContextMenu is in different logical tree, that's why RelativeSource doesnt work. But context menu inherit DataContext from its "container", in this case it is Button. It is enough in common case but in your case you need two "data contexts", of ItemsControl item and of ItemsControl itself. I think you have no other choice but combine your view models into one, implement custom class to be used as ItemsControl item data context and contain both "Name" and "Remove command" or your item's view model can define RemoveCommand "proxy", that would call parent command internally
EDIT: I slightly changed Baboon's code, it must work this way: