Syncfusion Essential Studio

BarItem Class

Represents an individual item that can be displayed in a menu structure, a tool bar or a popup menu in the XP Menus framework.

For a list of all members of this type, see BarItem Members.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         Syncfusion.Windows.Forms.Tools.XPMenus.BarItem
            Derived types

[Visual Basic]
Public Class BarItem
    Inherits Component
    Implements IChangeNotifyingItem, ICustomTypeDescriptor, ICloneable, ISerializable
[C#]
public class BarItem : Component, IChangeNotifyingItem, ICustomTypeDescriptor, ICloneable, ISerializable
[C++]
public __gc class BarItem : public Component, IChangeNotifyingItem, ICustomTypeDescriptor, ICloneable, ISerializable
[JScript]
public class BarItem extends Component, IChangeNotifyingItem, ICustomTypeDescriptor, ICloneable, ISerializable

Remarks

In order for the BarItem to be displayed, you must add it to the Items property of a ParentBarItem (to appear in menus or context menus) or a Bar (to appear in the tool bar). This is normally achieved using simple drag-and-drop during design-time. The BarItem will of course be rendered differently based on whether it is part of a menu structure or the tool bar.

The BarItem class provides properties that enable you to configure the appearance and functionality of a bar item. To display a check mark next to this bar item (when in a menu) or to give it a special checked highlight (when in a tool bar), use the Checked property. You can use this feature to identify a bar item that is selected in a list of mutually exclusive bar items. For example, if you have a set of bar items for setting the color of text in a TextBox control, you can use the Checked property to identify which color is currently selected.

The Shortcut property can be used to define a keyboard combination that can be pressed to select the bar item.

You can enable partial menus behavior in bar items when they are contained within a ParentBarItem by setting the BarItem's IsRecentlyUsedItem property.

In an MDI scenario, bar items added to an MDI parent's MainMenu(BarStyle.IsMainMenu enabled in the BarStyle property) and the MDI child's MainMenu will automatically be merged to create a consolidated menu structure.

Example

Take a look at our XPMenus samples under the Tools\Samples\Menus Package folder for usage example.

Requirements

Namespace: Syncfusion.Windows.Forms.Tools.XPMenus

Assembly: Syncfusion.Tools.Windows (in Syncfusion.Tools.Windows.dll)

See Also

BarItem Members | Syncfusion.Windows.Forms.Tools.XPMenus Namespace