<UserControl x:Class="_280191_TreeViewDataBindingTriStateCheck.MainPage"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
			 xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
			 xmlns:local="clr-namespace:_280191_TreeViewDataBindingTriStateCheck"
			 mc:Ignorable="d" 
			 d:DesignWidth="640" 
			 d:DesignHeight="480">

	<UserControl.Resources>
		<local:CheckStateConverter x:Key="CheckStateConverter"/>

		<telerik:ContainerBindingCollection  x:Name="BindingsCollection">
			<telerik:ContainerBinding PropertyName="CheckState" Binding="{Binding isSelected, Mode=TwoWay, Converter={StaticResource CheckStateConverter}}"/>
			<!--Other Container Bindings-->
		</telerik:ContainerBindingCollection>

		<!--Data template for the League object-->
		<telerik:HierarchicalDataTemplate x:Key="LeagueTemplate" 
										  ItemsSource="{Binding Divisions}"
										  telerik:ContainerBinding.ContainerBindings="{StaticResource BindingsCollection}">
			<TextBlock Text="{Binding Name}" Foreground="Black" FontWeight="Bold" FontSize="15" />
		</telerik:HierarchicalDataTemplate>

		<!--Data template for the Division object-->
		<telerik:HierarchicalDataTemplate x:Key="DivisionTemplate" 
										  ItemsSource="{Binding Teams}"
										  telerik:ContainerBinding.ContainerBindings="{StaticResource BindingsCollection}">
			<TextBlock Text="{Binding Name}" FontWeight="Bold" FontSize="12" />
		</telerik:HierarchicalDataTemplate>

		<!--Data template for the Team object-->
		<DataTemplate x:Key="TeamTemplate" telerik:ContainerBinding.ContainerBindings="{StaticResource BindingsCollection}">
			<TextBlock Text="{Binding Name}" FontWeight="Bold" FontSize="12" />
		</DataTemplate>

		<local:MyTemplateSelector x:Key="MyTemplateSelector" 
								  LeagueTemplate="{StaticResource LeagueTemplate}"
								  DivisionTemplate="{StaticResource DivisionTemplate}"
								  TeamTemplate="{StaticResource TeamTemplate}"/>

	</UserControl.Resources>

	<Grid>
		<telerikNavigation:RadTreeView x:Name="myTreeView" 
									   Width="290"  
									   ItemTemplateSelector="{StaticResource MyTemplateSelector}"
									   HorizontalAlignment="Left"
									   VerticalAlignment="Top"
									   IsExpandOnDblClickEnabled="True"
									   IsOptionElementsEnabled="True"
									   ItemsOptionListType="CheckList"
									   IsTriStateMode="True"/>
	</Grid>
</UserControl>
