WPF - Why do ContextMenu items work for ListBox but not ItemsControl?
问题 Items in a list have context menus. The context menu items are bound to routed commands. The context menu items work correctly if the list control is a ListBox , but as soon as I downgrade it to an ItemsControl it no longer works. Specifically the menu items are always greyed out. The CanExecute callback in my CommandBinding is not being called either. What is it about ListBox that allows context menu items with commands to bind correctly? Here are some excerpts from a sample app I put