Skip to main content

GridControl.EmbeddedNavigator Property

Allows to customize the embedded data navigator.

Namespace: DevExpress.XtraGrid

Assembly: DevExpress.XtraGrid.v23.2.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

[DXCategory("Appearance")]
public virtual ControlNavigator EmbeddedNavigator { get; }

Property Value

Type Description
ControlNavigator

The data navigator.

Remarks

Set the GridControl.UseEmbeddedNavigator property to true to enable the data navigator. The grid control displays the data navigator at the bottom. Use the EmbeddedNavigator property to customize the data navigator’s settings. You can display or hide certain command buttons, customize their appearance settings and hints.

Embedded Data Navigator - WinForms Data Grid

Run Demo

Enable, Disable Command Buttons

You can also use the Grid’s ColumnViewOptionsBehavior.AllowAddRows and ColumnViewOptionsBehavior.AllowDeleteRows options to enable or disable the “Append” and “Delete” buttons.

The enabled state of specific buttons (for example, End Edit, Cancel Edit) is controlled automatically and cannot be changed using the button’s Enabled property. For example, the Grid automatically enables the “End Edit” button (that posts the edit value to a data source) when a user activates a cell’s editor, and disables the button when the cell editor closes.

Handle Button Clicks

The following example demonstrates how to display a confirmation message after a user clicks the “Remove” command button and allow to cancel the action:

using System.Windows.Forms;
using DevExpress.XtraEditors;

public Form1() {
    InitializeComponent();
    // Binds the Grid control to a data source.
    gridControl1.DataSource = GetData();
    // Handles clicks on data navigator buttons.
    gridControl1.EmbeddedNavigator.ButtonClick += EmbeddedNavigator_ButtonClick;
}
private void EmbeddedNavigator_ButtonClick(object sender, NavigatorButtonClickEventArgs e) {
    if(e.Button.ButtonType == NavigatorButtonType.Remove)
        e.Handled = XtraMessageBox.Show("Do you want to delete the record?", "Warning", MessageBoxButtons.YesNo) == DialogResult.No;
}

Note

You can also link an external ControlNavigator to the Grid control. Place the ControlNavigator control onto a Form and bind it to the Grid (ControlNavigator.NavigatableControl).

Read the following topic for detailed information and examples: Data Navigators.

Example

In this example we change the visibility of two buttons of the embedded navigator: Append and Remove.

    ControlNavigator navigator = gridControl1.EmbeddedNavigator;
    navigator.Buttons.BeginUpdate();
    try {
        navigator.Buttons.Append.Visible = false;
        navigator.Buttons.Remove.Visible = false;
    }
    finally {
        navigator.Buttons.EndUpdate();
    }
See Also