NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MenuItem.DefaultItem

Gets or sets a value indicating whether the menu item is the default.

[Visual Basic]
Public Property DefaultItem As Boolean
[C#]
public bool DefaultItem {get; set;}
[C++]
public: __property bool get_DefaultItem();
public: __property void set_DefaultItem(bool);
[JScript]
public function get DefaultItem() : Boolean;
public function set DefaultItem(Boolean);

Property Value

true if the menu item is the default item in a menu; otherwise false. The default value is false.

Remarks

The default menu item for a menu is boldfaced. When the user double-clicks a submenu that contains a default item, the default item is selected, and the submenu is closed. You can use the TBD property to indicate, the default action that is expected in a menu or context menu.

Example [Visual Basic]

The following example creates a menu item with two submenu items. The following example assumes that there are three menu items defined, MenuItem1, MenuItem2, and MenuItem3. The example sets MenuItem2 as the default menu item using the TBD property.

[Visual Basic]

Public Sub CreateMyMenus()
   Set MenuItem1 = New MenuItem("File")
   Set MenuItem2 = New MenuItem("New")
   Set MenuItem3 = New MenuItem("Open")
   ' Make MenuItem2 ("New")the default menu item.
   MenuItem2.DefaultItem = True
End Sub

See Also

MenuItem Class | MenuItem Members | System.WinForms Namespace