[This post is part of the developer's manual preview published on this blog. You can find temporary TOC here.]
*** 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(); |
} |
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)
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.