New to Telerik UI for WPF? Download free 30-day trial

Chart Title

The ChartTitle is a content control placed at the top of each chart control. It is used to display any title information regarding the visualized chart.   WPF RadChart Chart Title

You can specify the content of the default ChartTitle control from XAML or code-behind, like this:

<telerik:RadChart x:Name="radChart"> 
    <telerik:RadChart.DefaultView> 
        <telerik:ChartDefaultView> 
            <telerik:ChartDefaultView.ChartTitle> 
 
                <telerik:ChartTitle HorizontalAlignment="Center" Content="Monthly Sales for 2009" /> 
 
            </telerik:ChartDefaultView.ChartTitle> 
        </telerik:ChartDefaultView> 
    </telerik:RadChart.DefaultView> 
</telerik:RadChart> 

this.radChart.DefaultView.ChartTitle.Content = "Monthly Sales for 2009"; 
radChart.DefaultView.ChartTitle.Content = "Monthly Sales for 2009" 

Since ChartTitle is a content control, you can set as its content not only textual data but also any other type of controls. The following example demonstrates how to create custom chart title with TextBlock in a Border control.

<telerik:RadChart> 
    <telerik:RadChart.DefaultView> 
        <telerik:ChartDefaultView> 
            <telerik:ChartDefaultView.ChartTitle> 
 
                <telerik:ChartTitle HorizontalAlignment="Center"> 
                    <Border BorderBrush="LightBlue" 
                            BorderThickness="2" 
                            CornerRadius="5"> 
                        <TextBlock Text="Monthly Sales for 2009" /> 
                    </Border> 
                </telerik:ChartTitle> 
 
            </telerik:ChartDefaultView.ChartTitle> 
        </telerik:ChartDefaultView> 
    </telerik:RadChart.DefaultView> 
</telerik:RadChart> 

Telerik.Windows.Controls.RadChart radChart = new Telerik.Windows.Controls.RadChart(); 
//.... 
Border border = new Border(); 
border.BorderThickness = new Thickness( 2 ); 
border.CornerRadius = new CornerRadius( 5 ); 
border.BorderBrush = new SolidColorBrush(Color.FromArgb( 255, 173, 216, 230 )); 
border.Child = new TextBlock(){ Text = "Monthly Sales for 2009" }; 
radChart.DefaultView.ChartTitle.Content = border; 
Dim radChart As New Telerik.Windows.Controls.RadChart() 
'....' 
Dim border As New Border() 
border.BorderThickness = New Thickness(2) 
border.CornerRadius = New CornerRadius(5) 
border.BorderBrush = New SolidColorBrush(Color.FromArgb(255, 173, 216, 230)) 
border.Child = New TextBlock() 
'Set the content of the ChartTitle' 
radChart.DefaultView.ChartTitle.Content = border 

And here is the final result:   WPF RadChart Custom Chart Title

If you want to learn more about styling the ChartTitle take a look at the Customizing Title topic.

See Also

In this article