TX Text Control .NET for Windows Forms

Add Method

Method|Introduced in 24.0
Namespace
TXTextControl.Windows.Forms.Ribbon
Package
TXTextControl.TextControl.WinForms.SDK as TXTextControl.Windows.Forms.dll from the private NuGet feed or Text Control Offline Packages

Description

Adds a control of the type RibbonButton, RibbonComboBox, RibbonLabel, RibbonListView, RibbonTextBox or RibbonSeperator to the end of the collection.

Syntax

public int Add(Control item);

Parameters

ParameterDescription
item

The control to be added to the end of this collection.

Return Value

The collection's index at which the value has been added.

Examples

The following example adds an item to the ribbon item collection.

var result = ribbonItemCollection.Add(new System.Windows.Forms.Control());
Console.WriteLine($"Add result: {result}");

Limitations

If the RibbonItemCollection is optained by a HorizontalRibbonGroup controls are added to the group's first row.

If the RibbonItemCollection is optained by a HorizontalRibbonGroup RibbonButtons where the DisplayMode property is set to IconTextRelation.LargeIconLabeled cannot be added.