# Populating with Data

There are several ways to populate a treeview with treeview items and they are:

* [Declaratively](https://www.telerik.com/products/wpf/documentation/controls/radtreeview/populating-with-data/declaratively) in your XAML code - suitable for cases when the treeview items structure is known during the implementation phase and does not change in time.

* [Programmatically](https://www.telerik.com/products/wpf/documentation/controls/radtreeview/populating-with-data/in-code-behind) from the code-behind - use when the treeview structure can be changed during run-time by the user or other application logic.

* Using [data binding](https://www.telerik.com/products/wpf/documentation/controls/radtreeview/populating-with-data/data-binding-to-xml) - use when the treeview structure is described in data module.

Each one of the approaches described above is applicable for certain cases and that’s why you have to choose the one that best fits your requirements.

> tip Bear in mind that the XAML file is the best place to declare your user interface; use the code-behind only when you cannot do that in XAML.

## See Also

* [Getting Started](https://www.telerik.com/products/wpf/documentation/controls/radtreeview/getting-started/getting-started)
* [Binding to XML](https://www.telerik.com/products/wpf/documentation/controls/radtreeview/populating-with-data/data-binding-to-xml)
* [Populating with data in XAML](https://www.telerik.com/products/wpf/documentation/controls/radtreeview/populating-with-data/declaratively)
