Back to Devexpress

BarItemLinkCollection.Add(BarItem) Method

windowsforms-devexpress-dot-xtrabars-dot-baritemlinkcollection-dot-add-x28-devexpress-dot-xtrabars-dot-baritem-x29.md

latest6.5 KB
Original Source

BarItemLinkCollection.Add(BarItem) Method

Creates a link to the specified bar item and adds it to the end of the collection.

Namespace : DevExpress.XtraBars

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public virtual BarItemLink Add(
    BarItem item
)
vb
Public Overridable Function Add(
    item As BarItem
) As BarItemLink

Parameters

NameTypeDescription
itemBarItem

A BarItem descendant, for which a link is added to the collection.

|

Returns

TypeDescription
BarItemLink

A BarItemLink object representing the link added.

|

Remarks

A bar item must belong to the BarManager’s BarManager.Items collection so that a link to it can be created and added to the collection. Otherwise, an exception will be raised.

To add several links to different bar items at once, see the BarItemLinkCollection.AddRange method.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(BarItem) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-dashboard-custom-properties/CS/WinForms-Dashboard-Custom-Properties/Modules/ChartScaleBreakModule.cs#L27

csharp
barItem = CreateBarItem("Scale Break", barImage);
group.ItemLinks.Add(barItem);
barItem.ItemClick += ChangeCustomPropertyValue;

winforms-dashboard-display-each-series-in-separate-pane-for-chart-items/CS/MultiPaneExtension/MultiPaneModule.cs#L303

csharp
group.ItemLinks.Add(enableBarItem);
group.ItemLinks.Add(showTitlesBarItem);

winforms-spreadsheet-spell-check-cell-text/CS/SpreadsheetSpellchecking/Form1.cs#L54

csharp
item.ItemClick += OnPopupMenu_ItemClick;
    itemLinks.Add(item);
}

winforms-dashboard-custom-items-extension/CS/CustomItemExtension/CustomItems/WebPageItem/WebPageItemExtensionModule.cs#L69

csharp
urlBarItem.EditWidth = 150;
    group.ItemLinks.Add(urlBarItem);
}

dashboard-constant-lines/CS/ConstantLineExtension.Win/ConstantLineModule.cs#L116

csharp
barItem = CreateBarItem();
    group.ItemLinks.Add(barItem);
}

winforms-dashboard-custom-properties/VB/WinForms-Dashboard-Custom-Properties/Modules/ChartScaleBreakModule.vb#L27

vb
barItem = CreateBarItem("Scale Break", barImage)
group.ItemLinks.Add(barItem)
AddHandler barItem.ItemClick, AddressOf ChangeCustomPropertyValue

winforms-dashboard-display-each-series-in-separate-pane-for-chart-items/VB/MultiPaneExtension/MultiPaneModule.vb#L254

vb
group.ItemLinks.Add(enableBarItem)
group.ItemLinks.Add(showTitlesBarItem)

winforms-spreadsheet-spell-check-cell-text/VB/SpreadsheetSpellchecking/Form1.vb#L59

vb
AddHandler item.ItemClick, AddressOf OnPopupMenu_ItemClick
    itemLinks.Add(item)
Next

winforms-dashboard-custom-items-extension/VB/CustomItemExtension/CustomItems/WebPageItem/WebPageItemExtensionModule.vb#L78

vb
urlBarItem.EditWidth = 150
    group.ItemLinks.Add(urlBarItem)
End Sub

See Also

AddRange

Insert

Remove(BarItemLink)

RemoveAt(Int32)

Items

Links

BarItemLinkCollection Class

BarItemLinkCollection Members

DevExpress.XtraBars Namespace