方式一:结合ItemClick事件实现
首先设置好,快捷键
代码:
class="csharpcode"> private void btnTools_ItemClick(object sender, ItemClickEventArgs e) { BarSubItemLink _link = e.Item.Links[0] as BarSubItemLink; if (_link != null) _link.OpenMenu(); }
效果:
方法二:上面方法需要每个barItem都需重复代码实现,结合BarManager的ShortcutItemClick则可以一劳永逸
private void barMain_ShortcutItemClick(object sender, ShortcutItemClickEventArgs e) { BarSubItemLink _barSublink = e.Item.Links[0] as BarSubItemLink; if (_barSublink != null) { _barSublink.OpenMenu(); return; } BarToolbarsListItemLink _barToollink = (BarToolbarsListItemLink)e.Item.Links[0]; if (_barToollink != null) _barToollink.OpenMenu(); }