public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            ObjectInTreeView d = VisualUpwardSearch(container);
            Type             t = (item as TreeNode).Type;

            if (t == null)
            {
                return(d.FindResource("ReadOnly") as DataTemplate);
            }
            else if (t != null)
            {
                if (((dynamic)item).Name == "Name" || ((dynamic)item).Name == "Vendor" ||
                    ((dynamic)item).Name == "DisplayName" || ((dynamic)item).Name.StartsWith("$"))
                {
                    return(d.FindResource("ReadOnly") as DataTemplate);
                }
                else if (((dynamic)item).Name == "ActionType")
                {
                    return(d.FindResource("ActionType") as DataTemplate);
                }
                else if (t == typeof(string))
                {
                    return(d.FindResource("Text") as DataTemplate);
                }
                else if (t == typeof(int) || t == typeof(Nullable <int>))
                {
                    return(d.FindResource("Integer") as DataTemplate);
                }
                else if (t == typeof(float) || t == typeof(Nullable <float>) ||
                         t == typeof(double) || t == typeof(Nullable <double>) ||
                         t == typeof(decimal) || t == typeof(Nullable <decimal>))
                {
                    return(d.FindResource("Decimal") as DataTemplate);
                }
                else if (t == typeof(bool) || t == typeof(Nullable <bool>))
                {
                    return(d.FindResource("Bool") as DataTemplate);
                }
                else if (t == typeof(DateTime) || t == typeof(Nullable <DateTime>))
                {
                    return(d.FindResource("DateTime") as DataTemplate);
                }
                else
                {
                    return(d.FindResource("ReadOnly") as DataTemplate);
                }
            }
            else
            {
                return(d.FindResource("ReadOnly") as DataTemplate);
            }
        }
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            ObjectInTreeView d = VisualUpwardSearch(container);
            Type             t = (item as TreeNode).Type;

            if (t == typeof(DateTime))
            {
                return(d.FindResource("DateTimeReadOnly") as DataTemplate);
            }
            else if (((dynamic)item).Name == "ActionType")
            {
                return(d.FindResource("ActionType") as DataTemplate);
            }
            else
            {
                return(d.FindResource("ReadOnly") as DataTemplate);
            }
        }