The below article describes how to add Menu, Context Menu for WPF application. It also gives solution for the problem of RoutedCommand during execution.
The following example shows the problem with simple window that has a Menu and a ContextMenu on it.
The CommandManager searches for CommandBindings within the current focus scope. If the current focus scope has no command binding, it transfers the focus scope to the parent focus scope. When you startup your application the focus scope is not set.
The simplest solution is to initially set the logical focus of the parent window that is not null. When the CommandManager searches for the parent focus scope it finds the window and handles the CommandBinding correctly.