How can I customize the menu to the situation in WPF?
I have a main window with a basic menu. In this window, I can load different UserControls and then I want the menu to be expanded with different menu options depending on which User Control is used.
Example:
Main menu:
File
Open
-
MRU
-
Exit
For viewing of UserControl 1:
File
Open
Edit
-
MRU
-
Exit
For viewing of UserControl 2:
File
Open
Edit
-
MRU
-
Exit
View
Show codes
Show capital letters
In Editing
File
Open
Save
Save as...
-
MRU
-
Exit
Edit
Add
Remove
Move
-
Cancle Edit
I would bind the menu to a Collection, and have the different UserControls alter the Collection when loaded.
EDIT – Here’s an example
Your main View would contain something like this
While each UserControl would contain a Collection property of the MenuItems you would like to display
…