Content Index Search
 

SimpleMenu and SimpleMenuItem

The menu is an items control that hierarchically organizes elements that are associated with commands and event handlers. You can place content in a menu in Microsoft® Expression Blend™ by double-clicking the menu and then drawing an element (such as a rectangle) into it. Alternatively, you can right-click the menu under Objects and Timeline, and then click Add SimpleMenuItem to add individual items to the collection, or click Bind ItemsSource to Data to generate the collection of MenuItem elements from a data source. To add a second-level menu item, you can right-click a menu item under Objects and Timeline and then click Add SimpleMenuItem, or add a custom menu item from the Local Styles tab of the Asset Library Asset Library button.

You can edit the text of the menu item by right-clicking the menu item under Objects and Timeline and then clicking Edit Text, or you can make the menu item active by double-clicking it and drawing a control into it. To view the child menu items of a menu item on the artboard while they are expanded, you can right-click the parent menu item under Objects and Timeline, and then click Expand MenuItem.

Artboard view: SimpleMenu

The artboard view of a SimpleMenu control after two items and a separator are added.

Breaking down the control template

The SimpleMenu control template consists of the following items:

The SimpleMenuItem control template consists of the following items:

Objects view: The basic parts (template) of SimpleMenu Objects view: The basic parts (template) of SimpleMenu

Objects view: The basic parts (template) of a SimpleMenu control (on the left) and a SimpleMenuItem control (on the right).

Property triggers used

Property triggers in the control template are used to make the control react to property changes. You can click the items under Triggers in the Interaction panel to view the properties that are changed when a trigger is active. For example, in the template for the menu item, when the IsChecked property is True, it means that the menu item to which the template is applied is checkable, so the GlyphPanel element is made visible by the trigger.

Brushes used

The following brush resources in the SimpleStyles.xaml resource dictionary are used by the SimpleMenu and SimpleMenuItem templates:

Additionally, the templates use bindings to system colors, which allow the controls to use the system defaults. In many cases, you may want to change these brushes so that you can create a unique design. You can do this by editing the Triggers that set the system colors.

Best practices and design guidelines

500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@informationworker.forsenergy.ru to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.