Articles in this section
Category / Section

How to scroll the legend items in Windows Phone Chart?

2 mins read


This article describes about customizing the SfChart legend items and modify their default template.


Scrollbar for the legends can be implemented by assigning the legend ItemsPresenter to the ScrollViewer of the legend ControlTemplate.

The customized ControlTemplate for the legend is defined in the static resource and it is assigned to the Template property of the chart legend.


<!-- Resource for the ControlTemplate of the legend is defined-->    
        <ControlTemplate x:Key="scroll">
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible" Margin="1" >
                <ItemsPresenter />
    <!--Customized ControlTemplate from static resource is assigned to legend Template-->
<syncfusion:ChartLegend DockPosition="Right" 
Template="{StaticResource scroll}">            



//Customized ControlTemplate from static resource is assigned to legend Template
(this.sampleChart.Legend as ChartLegend).Template = Resources["scroll"] as ControlTemplate;



The following screenshot illustrates the legend items with a scrollbar.

Pie Chart with legend scrollbar

Figure 1: Pie Chart with legend scrollbar

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment