Command binding not working in a dynamic MVVM Context Menu
问题 I am new to WPF. Like many others, I am trying to bind a ContextMenu to an ObservableCollection to create a dynamic context menu. Everything works except binding the Command property to the TheCommand property of the MenuItemViewModel class, that represents the menu item. The command is not fired. What am I doing wrong? To start from the beginning, the ContextMenu is a child of the Image and is shown when the mouse is over the Image . <Image.ContextMenu > <ContextMenu ItemsSource="