# TreeList Data Binding to Interface

Since version 2.27, the TreeList supports binding to a collection of multiple model types that implement the same interface.

Note the usage of [`OnModelInit`](https://www.telerik.com/blazor-ui/documentation/components/treelist/events#onmodelinit) in the example below. The event handler sets the model type to be used for new items in the TreeList. One-type model creation is supported out-of-the-box. If you need to support adding instances of different types:

* Use custom **Add** buttons in the [TreeList Toolbar](https://www.telerik.com/blazor-ui/documentation/components/treelist/toolbar), one for each model type.
* In each button click handler, define an `InsertedItem` of the correct type in the [TreeList State](https://www.telerik.com/blazor-ui/documentation/components/treelist/state).
* [Put the TreeList in Insert mode](https://www.telerik.com/blazor-ui/documentation/knowledge-base/treelist-add-edit-state) with the [SetStateAsync method](https://www.telerik.com/blazor-ui/documentation/components/treelist/state#methods).

> caption Data Binding the TreeList to an Interface

<demo metaUrl="client/treelist/data-binding/interface/example-1/" height="720"></demo>

> note Up to version 2.26, the `Data` collection of the TreeList must contain instances of only one model type.

## See Also

* [Binding to Flat Data](https://www.telerik.com/blazor-ui/documentation/components/treelist/data-binding/flat-data)
* [Binding to Hierarchical Data](https://www.telerik.com/blazor-ui/documentation/components/treelist/data-binding/hierarchical-data)
* [Load on Demand](https://www.telerik.com/blazor-ui/documentation/components/treelist/data-binding/load-on-demand)
* [Live Demo: TreeList Flat Data](https://demos.telerik.com/blazor-ui/treelist/binding-flat-data)
* [Live Demo: TreeList Hierarchical Data](https://demos.telerik.com/blazor-ui/treelist/binding-hierarchical-data)
* [Live Demo: TreeList Load on Demand](https://demos.telerik.com/blazor-ui/treelist/load-on-demand)
