Articles in this section
Category / Section

How to add ContextMenu for WPF Chart?

1 min read

ContextMenu can be added for WPF SfChart elements by setting ContextMenu with required MenuItem collection for SfChart. By raising the required events of MenuItem, you can customize the SfChart.

Similarly, you can also enable ContextMenu for other chart elements by raising the required events of MenuItem. You can check this implementation in this sample.


       <chart:SfChart x:Name="Chart" Margin="10" Background="White">
                    <MenuItem Header="Zooming" >
                        <MenuItem Header="EnableZooming" Click="ChartZoomItem_Click" />
                        <MenuItem Header="DisableZooming" Click="ChartZoomItem_Click"/>



    public partial class MainWindow : Window
        private ChartZoomPanBehavior zoomPanBehavior = new ChartZoomPanBehavior() { EnableZoomingToolBar = true, EnableSelectionZooming = true };
        // Method to enable and disable zooming for SfChart.
        private void ChartZoomItem_Click(object sender, RoutedEventArgs e)


Chart with zooming ContextMenu

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