Reference: Most important base classes - ControlPanel class

Reference: Most important base classes - ControlPanel class

Posted on April 21, 2009 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

[This post is part of the developer's manual preview published on this blog. You can find temporary TOC here.]
 

ControlPanel class is based on the ViewModeControl, just as any other View. ControlPanel is a special type of View - namely the root View of every module. In this article we are going to explore how to create a ControlPanel for your own modules and explain the most important members.

 

*** BEGIN NOTE ***

 

If you are building a module which supports multiple providers, you should use ProviderControlPanel class instead of ControlPanel class.

 

*** END NOTE ***

 


Usage


In the base module class (class which inherits from the WebModule base class or SecuredModule class), developer defines which class is a ControlPanel for this module and thus begins the View hierarchy of the module. ControlPanel is defined in the module class by overriding the CreateControlPanel method of the module class. Here is an example of how this looks for the built-in Lists module:
public override Control CreateControlPanel(TemplateControl parent) 
            return new ListsControlPanel(); 
 
The ControlPanel class, in example above ListsControlPanel, is declared as follows:
public class ListsControlPanel : ControlPanel<ListsControlPanel> 

 

*** BEGIN NOTE ***

 

Notice how ListControlPanel is a host to itself. Namely, the root View of the module hierarchy always has the host set to itself.

 

*** END NOTE ***

 

As we have already stated, ControlPanel class inherits from the ViewModeControl and thus the reference of the ViewModeControl is applicable to the ControlPanel class as well.

 

Constructors


ControlPanel class provides two constructors:
  • public ControlPanel()
  • public ControlPanel(bool autoGenerateViewCommands)
The empty constructor will by default turn on the automatic command generation feature. The second constructor offers us the possibility to turn off or on the automatic command generation feature by passing the Boolean value as a parameter.

 


Properties


  • ICommandPanel[] CommandPanels
    Gets an array of command panels containing the defined commands for the current View Mode.
  • BackendBreadcrumb BackendBreadcrumbControl
    Gets the reference to the BackendBreadcrumb control, a required control used by the ControlPanel View.
  • Control ControlPanelView
    Gets the reference to the required control in which the control panel child controls will be loaded.

Methods


  • void CreateStandardCommandPanels(string viewMode, List<CommandItem> commandsInfo, List<ICommandPanel> list)
    This is the method Sitefinity uses to automatically generate the commands. In case modifications need to be made, this method can be overridden.
  • void CreateCommandPanelsFromUserControls(string viewMode, List<string> userControls, List<ICommandPanel> list)
    This method is generally overridden in the actual implementation of the ControlPanel, when command panels based on User Controls should be added. You can find implementation samples here.
  • void CreateCustomCommandPanels(string viewMode, List<ICommandPanel> list)
    This method is generally overridden in the actual implementation of the ControlPanel, when command panels based on the custom controls should be added. You can find implementation samples here.
progress-logo

The Progress Team

View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments

Comments are disabled in preview mode.
Topics

Sitefinity Training and Certification Now Available.

Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.

Learn More
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

Loading animation