Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Binding to Data Overview

  • 8 minutes to read

DXTabControl can display data from a bound data source. The DXTabControl can be bound to any object that implements the IEnumerable interface or its descendant (e.g. IList, ICollection). To bind DXTabControl to a data source, use its DXTabControl.ItemsSource property.

When a DXTabControl is bound to a data source, its DXTabControl.Items collection is filled with data items. The tab control applies the DXTabControl.ItemTemplate template to each element within the collection.

Use the DXTabControl.GetTabItem method to obtain a tab item by its index.

#Example: How to bind DXTabControl to data

The following example demonstrates how to bind a tab control to data.

In this example, a tab control is bound to an IList collection which contains data items. The visual presentation of tab items and headers is specified via the DXTabControl.ItemTemplate and DXTabControl.ItemHeaderTemplate templates respectively. The datasource is assigned to the DXTabControl.ItemsSource property to bind the control to data.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DXTabControlExample.Common {
    public enum Gender { Female = 0, Male = 1 }
}