Skip to main content

Pane Title

  • 3 minutes to read

You can show a title above the pane to distinguish between multiple panes. End users can use the expand button next to the title to hide or show panes.

pane-title

This document explains how to:

Add a Pane Title

Each pane can have one title. To display the title, set its Visibility property to True. The title is shown with a button that allows you to collapse and expand a pane if the XYDiagramPaneBase.RuntimeCollapse (or XYDiagram2D.RuntimePaneCollapse) option is enabled. If an end user collapses a pane, other panes’ sizes are recalculated to occupy all the available space. Set RuntimeCollapse to false to hide the title expand button and prevent end users from collapsing panes.

To specify the title’s content, use the Text property. Its default value is the pane’s Name property value.

Note

The Chart Control can hide its elements if there is insufficient space to display them. Elements are hidden in the following order:

  1. Legends
  2. Axis Titles
  3. Series Titles
  4. Pane Titles
  5. Axes
  6. Chart Title
  7. Breadcrumbs

To make the Chart Control always display its elements, disable the ChartControl.AutoLayout property.

Add a Title at Design Time

You can configure a pane title’s options in the Properties window:

design-time-pane-title-settings

Add a Title in Code

The following code specifies a pane’s title text and visibility:

XYDiagramPane pane = diagram.Panes["Temperature Pane"];
if(pane != null) {
    pane.Title.Text = "Temperature";
    pane.Title.Visibility = DefaultBoolean.True;
}

The code above uses the following API members:

Member Description
XYDiagramPaneBase.Title Returns the pane title settings.
Title.Text Gets or sets title content.
PaneTitle.Visibility Specifies whether the title is visible.

Align a Pane Title

You can align a pane title to the pane’s top edge and configure indents between the title and other chart elements.

pane-title-alignment

The following code shows how to customize the alignment and margins:

pane.Title.Alignment = StringAlignment.Far;
pane.Title.Margins.Left = 0;
pane.Title.Margins.Top = 10;
pane.Title.Margins.Right = 0;
pane.Title.Margins.Bottom = 10;         

Use the following API members to align pane titles:

Member Description
PaneTitle.DXAlignment Specifies the title’s alignment.
PaneTitle.Margins Specifies the title’s outer indents.
RectangleIndents.Left Gets or sets the title’s left margin.
RectangleIndents.Top Gets or sets the title’s upper margin.
RectangleIndents.Right Specifies the title’s right margin.
RectangleIndents.Bottom Gets or sets the title’s lower margin.

Customize a Title’s Text Appearance

You can use the TitleBase.DXFont property to configure font parameters, and the TitleBase.TextColor property to change the title’s color.

pane-title-appearance

The following sample demonstrates how to change a title’s font and color:

using System.Drawing;
using DevExpress.Drawing;
// ...
pane.Title.DXFont = new DXFont("Tahoma", 14, DXFontStyle.Bold);
pane.Title.TextColor = Color.Gray;

The code above uses the following properties:

Property Description
TitleBase.DXFont Specifies the title’s font.
TitleBase.TextColor Defines the title’s text color.