WPF menu customization


/ Published in: C#
Save to your folder(s)

Add this code inside of the tags in the code behind.

Each Header is what you see. Command is the method that will be run when this menu item is selected. Image Source is an image that shows to the left of the word.


Copy this code and paste it in your HTML
  1. <Menu IsMainMenu="True">
  2. <MenuItem Header="_File" />
  3. <MenuItem Header="_Edit">
  4. <MenuItem Header="_Cut" Command="Cut">
  5. <MenuItem.Icon>
  6. <Image Source="Images/cut.png" />
  7. </MenuItem.Icon>
  8. </MenuItem>
  9. <MenuItem Header="_Copy" Command="Copy">
  10. <MenuItem.Icon>
  11. <Image Source="Images/copy.png" />
  12. </MenuItem.Icon>
  13. </MenuItem>
  14. <MenuItem Header="_Paste" Command="Paste">
  15. <MenuItem.Icon>
  16. <Image Source="Images/paste.png" />
  17. </MenuItem.Icon>
  18. </MenuItem>
  19. </MenuItem>
  20. </Menu>

Report this snippet


Comments


You need to login to view comments.