Menu

Introduction

Menu is a top-level menu bar control that docks to the top of the screen. It inherits from ItemsControl and contains MenuItem instances.

Code Example: Creating a Menu

The following code creates a Menu with File and Edit top-level items.

// Initialize
var menu = new Menu();
menu.AddToRoot();

var fileMenuItem = new MenuItem();
fileMenuItem.Header = "File";
menu.Items.Add(fileMenuItem);

var editMenuItem = new MenuItem();
editMenuItem.Header = "Edit";
menu.Items.Add(editMenuItem);

Try on XnaFiddle.NETarrow-up-right

For adding sub-items, handling activation events, and keyboard shortcuts, see the MenuItem page.

Last updated

Was this helpful?