private void CreateTitlePart(StackPanel p, Type type, string attribute, object value) {

      // Add Title
      var titleControl = new ComplexDataTitleControl(type.Name, _panels.Count > 0);
      titleControl.BackClick += titleControl_BackClick;
      titleControl.ContentViewToggled += titleControl_ContentViewToggled;

      p.Children.Add(titleControl);

      // Add Template bar (only for sub-data types, not commands them-selfs)
      if( _panels.Count > 0 ) {
        var tempControl = new ComplexDataTemplateControl(type, GetTempManager());
        tempControl.CreateTemplate += tempControl_CreateTemplate;
        tempControl.DeleteTemplate += tempControl_DeleteTemplate;
        tempControl.TemplateSelected += tempControl_TemplateSelected;
        tempControl.SelectTemplate(value);
        p.Children.Add(tempControl);

        var img = new Image();
        img.VerticalAlignment = System.Windows.VerticalAlignment.Top;
        img.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
        img.Height = 20;
        img.Width = 10;
        img.Margin = new Thickness(0, -15, 0, 0);
        img.Source = BitmapFrame.Create(_GetImageResourceStream("template-fold.png"));

        p.Children.Add(img);
      }

    }
        private void CreateTitlePart(StackPanel p, Type type, string attribute, object value)
        {
            // Add Title
            var titleControl = new ComplexDataTitleControl(type.Name, _panels.Count > 0);

            titleControl.BackClick          += titleControl_BackClick;
            titleControl.ContentViewToggled += titleControl_ContentViewToggled;

            p.Children.Add(titleControl);

            // Add Template bar (only for sub-data types, not commands them-selfs)
            if (_panels.Count > 0)
            {
                var tempControl = new ComplexDataTemplateControl(type, GetTempManager());
                tempControl.CreateTemplate   += tempControl_CreateTemplate;
                tempControl.DeleteTemplate   += tempControl_DeleteTemplate;
                tempControl.TemplateSelected += tempControl_TemplateSelected;
                tempControl.SelectTemplate(value);
                p.Children.Add(tempControl);

                var img = new Image();
                img.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
                img.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                img.Height = 20;
                img.Width  = 10;
                img.Margin = new Thickness(0, -15, 0, 0);
                img.Source = BitmapFrame.Create(_GetImageResourceStream("template-fold.png"));

                p.Children.Add(img);
            }
        }