# Data Binding

Displaying data in the **RadGridView** depends on the data binding mechanism. The entry point for the data to be bound is the **ItemsSource** property, which you must set in order to display data in your **RadGridView** control.

> tip For additional information regarding data binding and populating the **RadTreeListView** with data you can check the respective topics in the [RadGridView's documentation](https://www.telerik.com/products/wpf/documentation/controls/radgridview/populating-with-data/data-overview).

## Setting the ItemsSource property

As a typical data control the **RadGridView** displays data by binding to a source and generating visual elements for each item in it. The first thing that you have to do is to set the **ItemsSource** property of the **RadGridView**.

```C#

this.radTreeListView.ItemsSource = WarehouseService.GetWarehouseData();
```

```VB.NET

	Me.radTreeListView.ItemsSource = WarehouseService.GetWarehouseData()
```

## Types of Sources

Unlike the standard items control, the **RadGridView**'s **ItemsSource** property is declared to be of type **System.Object**. Of course, standard .NET collections that implement the **IEnumerable** interface are fully supported as well. If you want the insertions or the deletions in the collection to be automatically applied to the UI, the collection to which you bind must also implement the **INotifyCollectionChanged** interface. Coupling in your code, it may be more convenient to manipulate data in the original data source instead of using the **RadGridView** API. **RadGridView** listens to data source collection change events and reflects those changes in its visual representation. In Silverlight there is a built-in implementation of a data collection that exposes the **INotifyCollectionChanged** interface – the **ObservableCollection<T>** class.

> tip Consider using **ObservableCollection<T>** or one of the other existing collection classes like **List<T>**, **Collection<T>**, instead of implementing your own collection. If the scenario requires a custom collection to be implemented, use the **IList** interface, which provides individual access by index to its items and the best performance.

Introduced to the **System.ComponentModel** namespace collection views are fully supported as well. **RadGridView** will automatically pick up group descriptions, sort descriptions, or will filter settings defined on the collection view and will use those settings to display data.

## Binding the Columns

The data in the **RadGridView** is separated in columns. There are different types of columns, displaying different types of data. Usually the data is displayed in **GridViewDataColumns**, which can be manually generated, too. In order to display the data in it you can bind its **DataMemberBinding** property. Here is an example of a manually defined column.

```XAML

<telerik:RadTreeListView x:Name="radTreeListView"
	                            AutoGenerateColumns="False">
    <telerik:RadTreeListView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"
	                                    Header="Name" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Count}"
	                                    Header="Count" />
    </telerik:RadTreeListView.Columns>
</telerik:RadTreeListView>
```

## Binding the TreeListViewTableDefinitions

In order to display the hierarchical data the **RadTreeListView** uses child table definition of type **TreeListViewTableDefinition**. In order to display the underlying items in the hierarchy you have to bind its **ItemsSource** to the appropriate property.

> Note that a table definition will be generated for each row and it will have the same **DataContext** as the row. So you have to bind to the property, marking the collection that contains the next level of the hierarchy. This property should have the same name at each level of the hierarchy.

```XAML

<telerik:RadTreeListView>
    <telerik:RadTreeListView.ChildTableDefinitions>
        <telerik:TreeListViewTableDefinition ItemsSource="{Binding Items}">
        </telerik:TreeListViewTableDefinition>
    </telerik:RadTreeListView.ChildTableDefinitions>
</telerik:RadTreeListView>
```

## See Also

* [Getting Started](https://www.telerik.com/products/wpf/documentation/controls/radtreelistview/radtreeliestview-getting-started)

* [Hierarchy Column](https://www.telerik.com/products/wpf/documentation/controls/radtreelistview/features/hierarchy-column)

* [Managing Data](https://www.telerik.com/products/wpf/documentation/controls/radtreelistview/features/managing-data)
