<Window x:Class="WpfApp99.MainWindow"
        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:local="clr-namespace:WpfApp99"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
		mc:Ignorable="d"
        Title="MainWindow" 
		Height="500" Width="1009">

	<Window.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="pack://application:,,,/WpfApp99;component/ResourceTemplate.xaml" />
			</ResourceDictionary.MergedDictionaries>

			<telerik:StringToGlyphConverter x:Key="StringToGlyphConverter" />
			<local:MainWindowViewModel x:Key="MainWindowViewModel" />

			<DataTemplate x:Key="ATemplate">
                <local:UserControlA DataContext="{StaticResource MainWindowViewModel}" />
			</DataTemplate>
			<DataTemplate x:Key="BTemplate">
                <local:UserControlB DataContext="{StaticResource MainWindowViewModel}" />
			</DataTemplate>
			<DataTemplate x:Key="CTemplate">
				<local:UserControlC DataContext="{StaticResource MainWindowViewModel}" />
			</DataTemplate>

			<local:NavigationViewContentTemplateSelector x:Key="NavigationViewContentTemplateSelector" 
														 ATemplate="{StaticResource ATemplate}" 
														 BTemplate="{StaticResource BTemplate}"
														 CTemplate="{StaticResource CTemplate}"/>

			<Style x:Key="BaseNavigationViewItemStyle" TargetType="telerik:RadNavigationViewItem" BasedOn="{StaticResource RadNavigationViewItemStyle}">
				<Setter Property="DisplayMemberPath" Value="Title" />
				<Setter Property="Icon" Value="{Binding IconGlyph}" />
				<Setter Property="IconTemplate">
					<Setter.Value>
						<DataTemplate>
							<telerik:RadGlyph Glyph="{Binding Converter={StaticResource StringToGlyphConverter}}" />
						</DataTemplate>
					</Setter.Value>
				</Setter>
			</Style>
			<Style x:Key="ChildNavigationViewItemStyle" TargetType="telerik:RadNavigationViewItem" BasedOn="{StaticResource BaseNavigationViewItemStyle}">
				<Setter Property="IconVisibility" Value="Collapsed" />
			</Style>
		</ResourceDictionary>
	</Window.Resources>

	<Grid>
		<telerik:RadNavigationView	x:Name="radNavigationView"
									ItemsSource="{Binding Item}" 
									DisplayMemberPath="Title"
									DisplayMode="Expanded" AutoChangeDisplayMode="False"
									SelectedIndex="0" PaneHeader="Header">
			<telerik:RadNavigationView.ItemContainerStyle>
				<Style TargetType="telerik:RadNavigationViewItem" BasedOn="{StaticResource BaseNavigationViewItemStyle}">
					<Setter Property="IsSelectable" Value="{Binding IsSelectable}"/>
					<Setter Property="ItemsSource" Value="{Binding SubItems}" />
					<Setter Property="ItemContainerStyle" Value="{StaticResource ChildNavigationViewItemStyle}" />
				</Style>
			</telerik:RadNavigationView.ItemContainerStyle>

			<telerik:RadNavigationView.Content>
				<ContentControl Content="{Binding SelectedItem, ElementName=radNavigationView}" ContentTemplateSelector="{StaticResource NavigationViewContentTemplateSelector}" />
			</telerik:RadNavigationView.Content>

		</telerik:RadNavigationView>
	</Grid>
</Window>
