下面的示例展示了如何把按钮组布局应用到一组 bar item links。 通过 BarItemLink.ActAsButtonGroup 属性来启用按钮组布局。

C#CopyCode image复制代码
using DevExpress.XtraBars;

BarButtonItem[] items = new BarButtonItem[] {barButtonItem1, barButtonItem2, barButtonItem3 };

foreach (BarButtonItem item in items) {
    item.Links[0].ActAsButtonGroup = true;
}
Visual BasicCopyCode image复制代码
Imports DevExpress.XtraBars

Private items As BarButtonItem() = New BarButtonItem() {barButtonItem1, _ 
barButtonItem2, barButtonItem3 }

For Each item As BarButtonItem In items
    item.Links(0).ActAsButtonGroup = True
Next item