DataBinding - Overview
Data binding is a process of connecting the application User Interface and business logic.
DataContext
One very important aspect of the data binding is the DataContext. It is the data object, which is assigned to the specific framework element. You can assign DataContext both through code-behind and XAML:
<telerik:RadTreeView DataContext="{StaticResource Categories}" />
radTreeView.DataContext = new CategoryList();
radTreeView.DataContext = New CategoryList()
The DataContext property is inherited, e.g. if you assign a DataContext to an element, all of its children will automatically have the same data context, unless you assign them a different data context. For example, if you have the following control structure:
<Grid x:Name="LayoutRoot">
<telerik:RadTreeView x:Name="radTreeView1"/>
<telerik:RadTreeView x:Name="radTreeView2"/>
</Grid>
<Grid x:Name="LayoutRoot"DataContext="{StaticResource categories}">
<UserControl.Resources>
<local:CategoryList x:Key="categories" />
</UserControl.Resources>
Or in code-behind:
LayoutRoot.DataContext = new CategoryList();
LayoutRoot.DataContext = New CategoryList()