Explorer Bar
A vertical bar of titled, collapsible panels – the task pane down the side of Windows XP Explorer – for grouping the commands, links and details that go with the main content of a window.
Assembly
| Assembly | Binarymission.WinForms.Controls.BinaryExplorerBar.dll |
| Root namespace | Binarymission.WinForms.Controls.NavigationControls |
| Target frameworks | .NET Framework 4.8, .NET 6 / 8 / 10 |
Overview
What it is for
Use the bar where an application wants a side pane of related groups – "File and Folder Tasks", "Other Places", "Details" – each of which the user can open and close with a click on its title. The bar stacks the groups one under the other, scrolls when they do not fit, and animates them as they open and close.
Key concepts
- Panels. Each group is a
BinaryExplorerBarPanel: a real, scrolling container for your own controls. Add panels throughPanels; the bar places them, one under another, in the order of the collection. Controls added directly to the bar rather than to a panel are removed when it next lays itself out. - Titles. The title bar above each panel is drawn by the bar, not by the panel.
Clicking it expands or collapses that panel alone, after
BinaryExplorerBarPanelTitleClickedhas had the chance to refuse. Each panel opens and closes independently; any number can be open at once. - Defaults and overrides. The
DefaultPanel...properties of the bar give every panel title its font, colours, border and shadow. A panel uses its own value instead wherever it has one set – an empty colour means "use the bar's". - Resizing. While
IsPanelResizableis on, the user can drag the line under an expanded panel to make it taller or shorter.
How to use it
Create the panels, give each a BinaryExplorerBarPanel.PanelTitleText and an
expanded height (BinaryExplorerBarPanel.CurrentHeight), put your controls on them, and
add them to Panels. Open and close panels from code with
BinaryExplorerBarPanel.CurrentExplorerBarPanelState, ResetThisPanelState or
ResetAllPanelsState.
Appearance
Colour the bar yourself through GradientBeginColor, GradientEndColor,
BackgroundStyle and the DefaultPanel... properties, or let it imitate one of the
Windows XP colour schemes: set ThemeOrCustomColors to
ThemeOrCustomColors.PreDefinedTheme and choose an
XPTheme. ShadowDepth and DefaultPanelShadowDepth add soft
shadows under the bar and under each panel. Margins and depths are in logical pixels (1/96 inch) and
are scaled with the display.
Getting started
An Explorer-style task pane with three groups, in the XP blue scheme.
using System.Drawing;
using System.Windows.Forms;
using Binarymission.WinForms.Controls.NavigationControls;
public class DocumentsForm : Form
{
private readonly BinaryExplorerBarPanel detailsPanel;
public DocumentsForm()
{
Text = "Documents";
Size = new Size(820, 560);
var bar = new BinaryExplorerBar
{
Dock = DockStyle.Left,
Width = 230,
ThemeOrCustomColors = ThemeOrCustomColors.PreDefinedTheme,
DefaultPanelBorderColor = Color.SteelBlue,
DefaultPanelShadowDepth = 3,
};
var fileTasks = new BinaryExplorerBarPanel { PanelTitleText = "File and Folder Tasks", CurrentHeight = 90 };
AddLink(fileTasks, "Rename this file", 8);
AddLink(fileTasks, "Move this file", 32);
AddLink(fileTasks, "E-mail this file", 56);
var otherPlaces = new BinaryExplorerBarPanel { PanelTitleText = "Other Places", CurrentHeight = 66 };
AddLink(otherPlaces, "Shared Documents", 8);
AddLink(otherPlaces, "Network Places", 32);
detailsPanel = new BinaryExplorerBarPanel
{
PanelTitleText = "Details",
CurrentHeight = 60,
CurrentExplorerBarPanelState = BinaryExplorerBarPanelState.Collapsed, // starts closed
};
detailsPanel.Controls.Add(new Label { Text = "Quarterly report.xlsx\r\n48 KB", Location = new Point(8, 8), AutoSize = true });
bar.Panels.AddRange(new[] { fileTasks, otherPlaces, detailsPanel });
bar.XPTheme = XPTheme.Blue; // after ThemeOrCustomColors, and after the panels so they are themed too
bar.BinaryExplorerBarPanelTitleClicked += (sender, panel) => true; // return false to refuse a click
Controls.Add(bar);
}
private static void AddLink(BinaryExplorerBarPanel panel, string text, int top)
{
panel.Controls.Add(new LinkLabel { Text = text, Location = new Point(8, top), AutoSize = true });
}
}API reference
Binarymission.WinForms.Controls.NavigationControls
class BinaryExplorerBar | A vertical bar of titled, collapsible panels - the task pane down the side of Windows XP Explorer - for grouping the commands, links and details that go with the main content of a window. |
class BinaryExplorerBarPanel | One collapsible group in a BinaryExplorerBar: a scrolling container for your own controls, under a title the bar draws and the user clicks to open and close it. |
class BinaryExplorerBarPanelCollection | The ordered list of BinaryExplorerBarPanel objects a BinaryExplorerBar shows, from top to bottom. |
delegate BinaryExplorerBarPanelCollectionChangedEventHandler | Represents the method that handles a panel being inserted into or removed from a BinaryExplorerBarPanelCollection. |
delegate BinaryExplorerBarPanelCollectionClearedEventHandler | Represents the method that handles a BinaryExplorerBarPanelCollection being cleared. |
delegate BinaryExplorerBarPanelCollectionSetEventHandler | Represents the method that handles one panel in a BinaryExplorerBarPanelCollection being replaced by another. |
delegate BinaryExplorerBarPanelCollectionValidationEventHandler | Represents the method that checks a panel before a BinaryExplorerBarPanelCollection accepts it. |
enum BinaryExplorerBarPanelState | Specifies whether a BinaryExplorerBarPanel is open or closed to its title. |
delegate BinaryExplorerBarPanelTitleClickedHandler | Represents the method that handles BinaryExplorerBarPanelTitleClicked, and decides whether the clicked panel is allowed to expand or collapse. |
enum ControlBackgroundPaintingStyle | Specifies how a background is filled - the BinaryExplorerBar's own, or a panel title's. |
interface IBinaryControlExtendedServices | Infrastructure shared by the Binarymission navigation controls; not intended to be implemented or called by application code. |
enum ThemeOrCustomColors | Specifies where a BinaryExplorerBar takes its colours from while it is not following the system's visual style. |
enum XPTheme | Specifies a Windows XP colour scheme for a BinaryExplorerBar and its panels to imitate. |