The BindingNavigator control represents a standardized way to navigate and manipulate data on a form. In most cases, a BindingNavigator is paired with a BindingSource control to move through data records on a form and interact with them. In these cases, the BindingSource property is set to the associated System.Windows.Forms.BindingSource component that acts as a data source.
By default, the BindingNavigator control's user interface (UI) is composed of a series of ToolStrip buttons, text boxes, and static text elements for most common data-related actions, such as adding data, deleting data, and navigating through data. Each of these controls can be retrieved or set through an associated member of the BindingNavigator control. Likewise, there is also a one-to-one correspondence to members within the BindingSource class that programmatically perform the same functionality, as shown in the following table.
Adding a BindingNavigator control to a form and binding it to a data source, such as a BindingSource, will automatically establish the relationships in this table.
All the constructors for BindingNavigator call the AddStandardItems method to associate the standard set of UI controls with the navigation toolbar. Use one of the following techniques to customize this toolbar:
-
Create the BindingNavigator with the BindingNavigator(Boolean) constructor, which accepts a Boolean addStandardItems parameter, and set this parameter to false. Then add the desired ToolStripItem objects to the Items collection.
-
If a great deal of customization is desired, or the custom design will be reused, derive a class from BindingNavigator and override the AddStandardItems method to define additional or alternate standard items.