Disable Designer in Visual Studio

When double-clicking on custom user control code, Visual Studio may open a window with the message, “To add components to your class, drag them from the Toolbox and use the Properties window to set their properties. To create methods and events for your class, click here to switch to code view.”

To go to code view, you either have to:

  • Press F7
  • Or click on the “Click here to switch to code view.”

Instead, you can change the default behaviour of opening a user control to go straight to code view by applying the DesignerCategory Attribute to your custom user control class, e.g.

[System.ComponentModel.DesignerCategory("")]
public class MyUserControl : ...
{
   ...
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>