遍历DevExpressDevExpress.XtraBars.BarManager 控件

 遍历DevExpressDevExpress.XtraBars.BarManager 控件 并添加到树形 TreeView

 

Sub TreeListBind(ByVal links As DevExpress.XtraBars.BarItemLinkCollection,
                     ByRef treeNodeCollection As TreeNodeCollection)
        For Each link As DevExpress.XtraBars.BarItemLink In links
            If TypeOf link.Item Is DevExpress.XtraBars.BarButtonItem Then
                treeNodeCollection.Add(link.Item.Id, link.Item.Caption)


            End If
            If TypeOf link.Item Is DevExpress.XtraBars.BarSubItem Then
                treeNodeCollection.Add(link.Item.Id, link.Item.Caption)
                TreeListBind(CType(link.Item, DevExpress.XtraBars.BarSubItem).ItemLinks, treeNodeCollection.Item(treeNodeCollection.Count - 1).Nodes)
            End If
        Next
    End Sub

调用

Me.TreeListBind(BarManager.Bars(0).ItemLinks, TreeView1.Nodes)

你可能感兴趣的:(遍历DevExpressDevExpress.XtraBars.BarManager 控件)