Skip to main content

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 }
}