Genti Saliu
Genti Saliu

Reputation: 2723

Visual Inheritance, Design-time support for extended custom controls

I'm extending my own custom control, which extends the UserControl class.

I can see all the elements fine in the extending class' designer, but all the properties of the extended custom control appear disabled and when selecting its element with the mouse a "locked" icon appears.

How can I fix that? I would like to be able to modify these properties from the designer.

EDIT: Definition of the custom control, which extends from UserControl.

namespace Wizard
{
    [Designer(typeof(Wizard.StepDesigner))]
    [DefaultProperty("TitlePanel, NavigationPanel")]
    public partial class Step : UserControl
    {
         public Step()
         {
            InitializeComponent();
         }

         [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
         public Title TitlePanel
         {
              get
              {
                    return this.title1;
              }
              set
              {
                   this.title1 = value;
              }
          }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public Panel ContentPanel
        {
            get
            {
                 return this.contentPanel;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public Navigation NavigationPanel
        { 
             get
             {
                 return this.navigation1;
             }
         }
     }

     internal class StepDesigner : ParentControlDesigner
     {
         public override void Initialize(System.ComponentModel.IComponent component)
         {
            base.Initialize(component);

            if (this.Control is Step)
            {
                 Step control = (Step)this.Control;
                 this.EnableDesignMode(control.TitlePanel, "TitlePanel");
                 this.EnableDesignMode(control.ContentPanel, "ContentPanel");
                 this.EnableDesignMode(control.NavigationPanel, "NavigationPanel");
             }
         }  
     }
 }

Upvotes: 1

Views: 833

Answers (1)

Genti Saliu
Genti Saliu

Reputation: 2723

As I already pointed out in the comments, the modifiers of the properties were all set to private and changing them to protected and rebuilding the solution fixed the "problem".

Upvotes: 1

Related Questions