We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Right Click context menu separator

Thread ID:





101567 Nov 2,2011 07:06 PM UTC Nov 7,2011 02:50 AM UTC WPF 1
Tags: Chart
George G
Asked On November 2, 2011 07:06 PM UTC

How do you add a menu separator to a Syncfusion chart right click context menu?

This is a dynamic menu and can't be done directly in XAML.

We're using Syncfusion.Chart.WPF.DLL version in a .net 4.0 WPF desktop application.

Here is a simplified version of our code to create the chart and right click menu.

Chart g = new SyncFusion.Windows.Chart.Chart();

..setup other chart properties

ChartArea chartArea = new ChartArea();

..setup other chart area properties

chartArea.IsContextMenuEnabled = true;
chartArea.ContextMenuType = ContextMenuTypes.Custom;

//add menu items to right click context menu

MenuItem m = new MenuItem();
m.Header = "Show test dialog";
m.PreviewMouseLeftButtonUp += new MouseButtonEventHandler(ShowTextDialog_OnClick);

//separator should go here

MenuItem m2 = new MenuItem();
m2.Header = "Show test dialog2";
m2.PreviewMouseLeftButtonUp += new MouseButtonEventHandler(ShowTextDialog2_OnClick);


Ganesan [Syncfusion]
Replied On November 7, 2011 02:50 AM UTC

Hi George,

We have analyzed your requirement, and there is no special support for adding a separator to the context menu. But your requirement can be achieved by overriding the datatemplate of contextmenuitem header as in below code snippet.

Code Snippet [Xaml]:

Code Snippet [C#]:

area.IsContextMenuEnabled = true;

area.ContextMenuType = ContextMenuTypes.Custom;

ContextMenu menu = new ContextMenu();

MenuItem seperator = new MenuItem();

seperator.Height = 7;

seperator.Width = 200;

seperator.VerticalContentAlignment = System.Windows.VerticalAlignment.Stretch;

seperator.HeaderTemplate = this.Resources["Seperator"] as DataTemplate;

seperator.Header = "Seperator Header";

menu.Items.Add("Rotate Series");





area.ContextMenu = menu;

Based on your requirement we have created a simple sample, which you can download from the link below.


Please let us know if you have any concerns.




This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon