Controls > WebDock > Advanced

Programmatic Access

This section describes how to access WebDock and its associated objects in code-behind.

Namespace

The namespace required by ZeeControls:

using ZettaCube.ZeeControls;

WebDock

The WebDock class represents containers. E.g.:

WebDock1.FitParent = FitParentEnum.FitWindow;
WebDock1.DockBarSize = 25;   

WebDockPanel and WebDockPanelGroup

The WebDockPanel class represents dock panels, and the WebDockPanelGroup class represents panel groups.

If a panel/group has an explicit ID, it can be accessed directly. E.g.:

WebDockPanel1.Dock = DockEnum.Bottom;
WebDockPanelGroup1.PreferredSize = 200;

Alternatively, a panel/group can be accessed via the Panels collection in WebDock or WebDockPanelGroup. Note that the Panels is a collection of WebDockPanelBase objects, which can be WebDockPanel, WebDockUpdatePanel, or WebDockPanelGroup objects.

// Access the 3rd panel of WebDock1 as a panel group
WebDockPanelGroup panelGroup = WebDock1.Panels[2] as WebDockPanelGroup;
if (panelGroup != null) {
    // Access the 4th panel of panelGroup

    WebDockPanel panel = panelGroup.Panels[3] as WebDockPanel;
    if (panel != null) {
        // Activate tabbed panel 1
        panel.ActiveTabIndex = 1;
    }
}

WebDockTabbedPanel

The content area of each tabbed panel (i.e. exclude the tab strip) in a dock panel is represented by the WebDockTabbedPanel class.

If a tabbed panel has an explicit ID, it can be accessed directly. E.g.:

WebDockTabbedPanel1.ForeColor = System.Drawing.Color.Green;

Alternatively, it can be accessed via the Tabs collection in WebDockPanel:

WebDockPanel1.Tabs[1].ForeColor = System.Drawing.Color.Green;   

WebDockActionButtonProps, WebDockSplitterProps, WebDockTabStripProps

The WebDockActionButtonProps, WebDockSplitterProps and WebDockTabStripProps classes represents the collections of properties of action buttons, splitter bars and tab strips respectively. These 3 classes correspond to the ActionButtonProps, SplitterProps, and TabStripProps properties in a WebDock. E.g.:

WebDockActionButtonProps actionButtonProps = WebDock1.ActionButtonProps;
actionButtonProps.ShowClose = true;
WebDockSplitterProps splitterProps = WebDock1.SplitterProps;
splitterProps.LiveRefresh = true;
WebDockTabStripProps tabStripProps = WebDock1.TabStripProps;
tabStripProps.ShowTabIcons = false;

Every WebDock must have an ID (unique on the page) assigned. IDs for panels or panel groups are optional. However, you need to assign an ID to a panel or panel group if you want to refer to it by ID in the code-behind.