Reputation: 8188
How can I add a button to a my ribbon group programmically? Here is my code so far that successfully Adds a new ribbonPage, then Adds a RibbonGroup to the page. But I need to add buttons to the ribbonGroup and its not working for me
Imports DevExpress.XtraBars.Ribbon
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim menu As New RibbonControl
Dim aPage As New RibbonPage("Nicks Page")
'groups
Dim aGroup1 As New RibbonPageGroup("1st Group")
'ADD BUTTONS TO RIBBON GROUP HERE
aPage.Groups.Add(aGroup1)
menu.Pages.Add(aPage)
Me.Controls.Add(menu)
End Sub
Upvotes: 1
Views: 4278
Reputation: 15242
You will need to make a new button for the ribbon control as such:
Dim newButton As New DevExpress.XtraBars.BarButtonItem
Then add this to your Ribbon Page Group
aGroup1.Container.Add(newButton)
Upvotes: 1