using System.Windows;
using System.Windows.Controls;
using Telerik.Windows.Controls;

namespace WpfApp99
{
    public class NavigationViewContentTemplateSelector : DataTemplateSelector
    {
        public DataTemplate UserControlMain { get; set; }
        public DataTemplate ATemplate { get; set; }
        public DataTemplate BTemplate { get; set; }
        public DataTemplate CTemplate { get; set; }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            var navigationItemModel = item as RadNavigationViewItem;

            switch (navigationItemModel.Content)
            {
                case "MainView": return this.UserControlMain;
                case "UserControrl A": return this.ATemplate;
                case "UserControrl B": return this.BTemplate;
                case "UserControrl C": return this.CTemplate;
                //I want to go back to the previous view, not the Main.
                default:
                    return this.UserControlMain; // null =>? excpetion
            }
        }
    }

}
