RibbonBarItemButton
Namespace: Wisej.Web.Ext.RibbonBar
Assembly: Wisej.Web.Ext.RibbonBar (4.1.0.0)
Represents a button in a RibbonBarGroup.
- C#
- VB.NET
public class RibbonBarItemButton : RibbonBarItem
Public Class RibbonBarItemButton
Inherits 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
RibbonBarItemButton()
Initializes a new instance of RibbonBarItemButton.
Properties
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.
MenuItems
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;
}
};
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 });
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
Dispose(disposing)
Disposes the control.
| Parameter | Type | Description |
|---|---|---|
| disposing | Boolean | true when this method is called by the application rather than a finalizer. |
OnAddReferences(items)
Adds references components to the list. Referenced components can be added individually or as a reference to a collection.
| Parameter | Type | Description |
|---|---|---|
| items | IList | Container for the referenced components or collections. |
OnItemClick(e)
Fires the ItemClicked event.
| Parameter | Type | Description |
|---|---|---|
| e | RibbonBarMenuItemEventArgs | A RibbonBarMenuItemEventArgs that contains the event data. |
OnPushedChanged(e)
Fires the PushedChanged event.
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | A EventHandler that contains the event data. |
OnWebEvent(e)
Processes the event from the client.
| Parameter | Type | Description |
|---|---|---|
| e | WisejEventArgs | Event arguments. |
OnWebRender(config)
Renders the client component.
| Parameter | Type | Description |
|---|---|---|
| config | Object | Dynamic configuration object. |
Events
ItemClicked
RibbonBarMenuItemEventHandler Fired when the user clicks one of the drop down menu items.
PushedChanged
EventHandler Fired when the value of the Pushed property changes.
Inherited By
| Name | Description |
|---|---|
| RibbonBarItemSplitButton | Represents a split button in a RibbonBarGroup. |
Implements
| Name | Description |
|---|---|
| IUserData | |
| IWisejComponent | |
| IWisejSerializable |