Axis Titles

  • 2 minutes to read

The 2D XY Diagram's axes (both primary and secondary ones) can have a title.


This document consists of the following sections:

How to Add a Title to an Axis

The markup below shows how to create titles for x- and y-axes and specify their content:

                <dxc:AxisTitle Content="Year"/>
                <dxc:AxisTitle Content="Oil Price (USD)"/>

Use the following classes and properties to configure axis titles:

Class or Property Description
XYDiagram2D The XY Diagram.
XYDiagram2D.AxisX Gets or sets an x-axis.
XYDiagram2D.AxisY Gets or sets a y-axis.
AxisX2D An x-axis.
AxisY2D A y-axis.
Axis.Title Gets or sets the axis title's options.
AxisTitle The axis title.
TitleBase.Content The axis title's content.

How to Modify Title Appearance

The Chart control makes it possible to alter the axis title's appearance in different ways. For example, you can assign a DataTemplate object to the TitleBase.ContentTemplate property.


The following XAML markup shows how to do this:

    <DataTemplate x:Key="axisTitle">
        <TextBlock Text="{Binding}"
            <dxc:AxisTitle Content="Oil Price (USD)" 
                           ContentTemplate="{StaticResource axisTitle}"

Use the following properties to apply a data template for axis title customization:

Property Description
TitleBase.Content Specifies a axis title content.
TitleBase.ContentTemplate Gets or sets a template that specifies how the title looks.
AxisTitle.Alignment Gets or sets the axis title's alignment.
See Also