A newer version of this page is available. Switch to the current version.

DataNavigator.DataSource Property

Gets or sets a data source for the DataNavigator control.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v19.2.dll

Declaration

[DXCategory("Data")]
[DefaultValue(null)]
public object DataSource { get; set; }

Property Value

Type Default Description
Object

null

A data source object whose data is managed by the data navigator.

Remarks

The DataNavigator control is used to navigate through the records in a data source and perform operations on the data. Thus, it needs to be associated with a data source in order to receive and manipulate data.

The DataSource property represents the object used as a data source. Generally, the data source object is represented by the DataSet component. The data source can contain a multiple set of data (several tables, for instance). Use the DataNavigator.DataMember property to specify the appropriate table whose contents are to be navigated and manipulated by the data navigator.

Examples

The following code shows how to create a new DataNavigator control, bind it to a data source and specify custom images for the control's buttons at runtime. The custom images are stored in an ImageCollection object.

DataNavigator ctor

using DevExpress.XtraEditors;

private void CreateDataNavigator() {
    // Create a new DataNavigator control
    DataNavigator dataNavigator = new DataNavigator();
    Controls.Add(dataNavigator);
    dataNavigator.Height = 40;
    dataNavigator.Dock = DockStyle.Bottom;
    // Bind to a data source
    dataNavigator.DataSource = productsBindingSource;
    // Specify the ImageCollection that stores custom images for the DataNavigator's buttons
    dataNavigator.Buttons.ImageList = imageCollection1;
    for (int i = 0; i < dataNavigator.Buttons.ButtonCollection.Count; i++) {
        dataNavigator.Buttons.ButtonCollection[i].ImageIndex = i;
    }
    dataNavigator.ShowToolTips = true;
}
See Also