Skip to main content

RibbonBarItemButton

Namespace: Wisej.Web.Ext.RibbonBar

Assembly: Wisej.Web.Ext.RibbonBar (4.1.0.0)

Represents a button in a RibbonBarGroup.

public class RibbonBarItemButton : RibbonBarItem

The button can be displayed large, with the image above the text (Vertical, the default), or small, with the image to the left of the text (Horizontal).

When the button has MenuItems, clicking it opens the drop down menu and doesn't fire the click events; clicking a menu item fires ItemClicked and MenuButtonItemClick. Use RibbonBarItemSplitButton to have both a clickable button and a drop down menu. Without menu items, clicking the button fires Click and ItemClick.

Constructors​

Instance member RibbonBarItemButton()​

Initializes a new instance of RibbonBarItemButton.

Properties​

Instance member ColumnBreak​

Boolean: Returns or sets a value indicating whether a new column starts after this RibbonBarItem.

Value: true if the next item in the RibbonBarGroup is placed in a new column; otherwise, false.

Always returns true when Orientation is Vertical, since large buttons occupy a column of their own. The value set is used only when Orientation is Horizontal.

MenuItemCollection: Returns the collection of MenuItem objects associated with the button.

Value: A MenuItemCollection that represents the list of MenuItem objects stored in the menu.

When the collection contains at least one item, the button shows a drop down arrow and clicking it opens the menu below the button instead of firing the click events. Clicking a menu item, at any level, fires the ItemClicked event on this button and the MenuButtonItemClick event on the RibbonBar.

Example:

Adding a drop down menu to a button and handling the clicks on the menu items:

this.buttonPaste.MenuItems.Add(new MenuItem("Paste") { Name = "paste" });
this.buttonPaste.MenuItems.Add(new MenuItem("Paste Special...") { Name = "pasteSpecial" });
this.buttonPaste.MenuItems.Add(new MenuItem("Paste as Text") { Name = "pasteText" });

this.buttonPaste.ItemClicked += (s, e) =>
{
switch (e.MenuItem.Name)
{
case "paste": Paste(); break;
case "pasteSpecial": new PasteSpecialDialog().ShowDialog(); break;
case "pasteText": PasteAsText(); break;
}
};

Instance member Orientation​

Orientation: Returns or sets the layout orientation of the RibbonBarItemButton. (Default: Vertical)

Value: One of the Orientation values. The default is Vertical.

Vertical displays a large button with the image above the text that fills the height of the group and occupies a column of its own. Horizontal displays a small button with the image to the left of the text; small buttons are stacked vertically in the same column until an item has ColumnBreak set to true. Buttons added to a RibbonBarItemButtonGroup are always changed to Horizontal.

Example:

Creating a large button and two small buttons stacked in the next column:

this.ribbonBarGroup1.Items.Add(new RibbonBarItemButton { Text = "Paste", ImageSource = "icon-paste" });
this.ribbonBarGroup1.Items.Add(new RibbonBarItemButton { Text = "Cut", ImageSource = "icon-cut", Orientation = Orientation.Horizontal });
this.ribbonBarGroup1.Items.Add(new RibbonBarItemButton { Text = "Copy", ImageSource = "icon-copy", Orientation = Orientation.Horizontal });

Instance member Pushed​

Boolean: Returns or sets whether the RibbonBarItemButton is rendered using the "pushed" state. (Default: False)

Value: true if the button is displayed as pushed; otherwise, false. The default is false.

The pushed state is only visual: the button doesn't toggle it automatically when clicked. Changing the value fires the PushedChanged event.

Example:

Using the button as a toggle button:

private void buttonBold_Click(object sender, EventArgs e)
{
this.buttonBold.Pushed = !this.buttonBold.Pushed;
ApplyBold(this.buttonBold.Pushed);
}

Methods​

Protected member Dispose(disposing)​

Disposes the control.

ParameterTypeDescription
disposingBooleantrue when this method is called by the application rather than a finalizer.

Protected member OnAddReferences(items)​

Adds references components to the list. Referenced components can be added individually or as a reference to a collection.

ParameterTypeDescription
itemsIListContainer for the referenced components or collections.

Instance member OnItemClick(e)​

Fires the ItemClicked event.

ParameterTypeDescription
eRibbonBarMenuItemEventArgsA RibbonBarMenuItemEventArgs that contains the event data.

Instance member OnPushedChanged(e)​

Fires the PushedChanged event.

ParameterTypeDescription
eEventArgsA EventHandler that contains the event data.

Protected member OnWebEvent(e)​

Processes the event from the client.

ParameterTypeDescription
eWisejEventArgsEvent arguments.

Protected member OnWebRender(config)​

Renders the client component.

ParameterTypeDescription
configObjectDynamic configuration object.

Events​

Instance member ItemClicked​

RibbonBarMenuItemEventHandler Fired when the user clicks one of the drop down menu items.

Instance member PushedChanged​

EventHandler Fired when the value of the Pushed property changes.

Inherited By​

NameDescription
RibbonBarItemSplitButtonRepresents a split button in a RibbonBarGroup.

Implements​