I'm trying to create a custom BindingNavigator control in with some extra ToolStripButton (Edit and ExportToExcel).
The ToolStripButton is added to the BindingNavigator, but I cannot select this new ToolStripButton, e.g., to add code in its Click event handler. Actually, the ToolStripButtons appear locked.
Here is my code and an image that should describe the problem:
using System.Windows.Forms;
public class BindingNavigator : System.Windows.Forms.BindingNavigator
{
public ToolStripButton btnEdit;
public ToolStripButton btnExcelExport;
public BindingNavigator()
{
this.LayoutCompleted += BindingNavigator_LayoutCompleted;
}
public void BindingNavigator_LayoutCompleted(object sender, System.EventArgs e)
{
if (this.Items.Contains(btnEdit))
return;
if (this.Items.Count >= 11)
{
btnEdit = new ToolStripButton();
btnEdit.Image = global::BaseControls.Properties.Resources.Edit___16x16;
btnEdit.Name = "btnEdit";
this.Items.Insert(10, btnEdit);
this.Items.Add(new ToolStripSeparator());
btnExcelExport = new ToolStripButton();
btnExcelExport.Image = global::BaseControls.Properties.Resources.Excel___16x16;
btnExcelExport.Name = "btnExcelExport";
this.Items.Insert(13, btnExcelExport);
}
}
}

The BindingNavigator class has a dedicated Designer,
BindingNavigatorDesigner, derived fromToolStripDesigner.The Designer calls the public virtual AddStandardItems() method, which is then called by Form Designer when a BindingNavigator is added to a Form.
To make your Buttons functional, override this method in a custom class and add new buttons here.
Now your ToolStripButtons are serialized in the Form Designer and, if you double-click one of your custom buttons, a
Clickhandler is added to the Form.Notes you can find in the .Net Source Code:
As you can see, now the buttons are fully functional
I suggest you modify your custom BindingNavigator like this:
▶ Don't name your Custom Control
BindingNavigator