[]
        
(Showing Draft Content)

Icons

Icons help users recognize menu items at a glance, and they’re the only identifier of an item when the menu is collapsed to IconsOnly. A menu item gets its icon from a C1.Framework icon type, which you wrap in a menu icon type and assign to the item. This approach lets menu items display consistent ComponentOne icons within the menu.

Without Icon

With Icon

C1WinForms Hamburger Menu - Menu items without icons

C1WinForms Hamburger Menu - Menu items with icons

Property

Type

Description

C1HamburgerMenuItem.Icon

C1HamburgerMenuIcon

The default icon. Wrap a C1BitmapIcon or C1PathIcon by using new C1HamburgerMenuIcon(icon).

C1HamburgerMenuItem.ExpandedIcon

C1PathIcon

The icon that's displayed while the item is expanded.

C1HamburgerMenuItem.CollapsedIcon

C1PathIcon

The icon that's displayed while the item is collapsed.

ToggleButton.Icon

C1HamburgerMenuIcon

The icon of the hamburger button.

The Icon property identifies the menu item. The ExpandedIcon and CollapsedIcon properties indicate whether the item’s child list is expanded or collapsed, such as chevron icons used for hierarchical navigation.

C1HamburgerMenuIcon supports separate images for the following interaction states:

  • DefaultIcon

  • DisabledIcon

  • HoveredIcon

  • PressedIcon

  • ExpandedIcon

When a single icon is passed to the C1HamburgerMenuIcon constructor, the control uses that image as the default icon.


Bitmap Icon

C1BitmapIcon displays bitmap images in menu items.

The following example creates a bitmap icon from a project resource and assigns it to a menu item.

var bmp = new C1BitmapIcon
{
    Size = new Size(20, 20),
    Padding = new Thickness(3),
    Source = Properties.Resources.Calendar,
    Stretch = Stretch.Uniform
};
item.Icon = new C1HamburgerMenuIcon(bmp);

Path Icon

A C1PathIcon provides a scalable vector image for interface elements such as expand/collapse chevrons and toggle buttons.

The following example creates chevron-down and chevron-up icons and assigns them to a parent menu item.

var down = new C1PathIcon
{
    Data = "M0,0 L1.75,0 L3.5,2 L5.25,0 L7,0 L3.5,4 z",
    Size = new Size(20, 20),
    Padding = new Thickness(5)
};
var up = new C1PathIcon
{
    Data = "M0,4 L1.75,4 L3.5,2 L5.25,4 L7,4 L3.5,0 z",
    Size = new Size(20, 20),
    Padding = new Thickness(5)
};
parentItem.ExpandedIcon = down;
parentItem.CollapsedIcon = up;

Multiple menu items can share a single C1PathIcon instance. To display an item’s child entries when the menu is first shown, set the item’s Expanded property to true.