I am working on a multi-tasking application (for Ex: a multi-page text editor) where each tabitem has its own content. And in the tabitem context menu, they are menuitem with a command, for example, the SelectAll command.
After starting the application, the menu item is always disabled, the command is not executed.
So how can I make my teams work?
CODE::
In the context menu in TextEditor>
<MenuItem Command="local:TextEditor.SelectAllCommand" Header="Select All" />
In CommandBindings in TextEditor>
<UserControl.CommandBindings> <CommandBinding Command="local:TextEditor.SelectAllCommand" Executed="SelectAll_Executed" CanExecute="SelectAll_CanExecute" /> </UserControl.CommandBindings>
TabItems with TextEditor are created at runtime
source share