How to remove the Annotation menu item from contextmenu

Hi,
       I want to remove the Annotation menu item from the contextmenu of ChartArea. Is it possible?  Any help will be appreciated.
 
regards,
bean

1 Reply

KV Karthikeyan V Syncfusion Team March 6, 2014 07:13 AM UTC

Hi Bean,

 

Thank you for using syncfusion products.

 

We have analysed the reported requirement and this can be achieved with the help of the below code snippet.

Code Snippet [C#]:

Chart1.Areas[0].ContextMenu.Opened += ContextMenu_Opened;

      

void ContextMenu_Opened(object sender, RoutedEventArgs e)

{

     ChartAreaContextMenu menu = sender as ChartAreaContextMenu;

     for (int i = 0; i < menu.Items.Count; i++)

     {

         MenuItem item = (MenuItem)menu.Items[i];

         if (item.Header.ToString() == "Add Annotation")

            menu.Items.Remove(item);

     }

}

 

Please let us know if you require further assistance on this.

 

Thanks,

Karthikeyan V.


Loader.
Up arrow icon