Customization menus
Good day.
I am considering using syncfusion charts in my application but before i do i want to check on a few prerequisites I need them to do.
I really like the default tool bar and the context menus, however i need the user to be able to change nore properties that are not available by default (such as grid line properties, axis labels, skins, among other visual details). Is it possible to add these properties to the toolbar, or probably the better option, context menus?
I know I could expose all properties with a propertyGrid. But i dont really want the user having to navigate so many properties that they dont even need.
Also, does the GridControl support similar context menus or toolbars as well, so that a user can customize it's look at runtime?
thanks!
SIGN IN To post a reply.
3 Replies
SK
Saravana Kumar Kanagavel
Syncfusion Team
November 13, 2017 03:39 PM UTC
Hi Travis,
Thanks for contacting Syncfusion Support.
We have analyzed your query and prepared a sample based on you requirement. In the sample, we have added the custom menu in ChartContextMenu().
Please find the code snippet below
|
[C#]
private void InitializeChartData()
{
// Enable the context menu
this.chartControl1.ShowContextMenu = true;
//Event handler for context menu while pop up
this.chartControl1.ChartContextMenu.Popup += ChartContextMenu_Popup; }
private void ChartContextMenu_Popup(object sender, EventArgs e)
{
// Creating the chart context menu
ChartContextMenu menu = sender as ChartContextMenu;
// Creating the menu
MenuItem item = new MenuItem("Custom Menu");
// Added child menu in main menu
MenuItem item1 = new MenuItem("PrimaryXAxis",new EventHandler(Item_Click1));
MenuItem item2 = new MenuItem("PrimaryYAxis", new EventHandler(Item_Click1));
item.MenuItems.Add(item1);
item.MenuItems.Add(item2);
menu.MenuItems.Add(item);
} |
And you can find the sample from the below location.
Please find the output of the sample below
You can able to add the custom tool bar in chart tool bar and please find the code snippet below
|
[C#]
private void InitializeChartData()
{
// Add custom tool bar
AddCustomToollBar();
}
private void AddCustomToollBar()
{
// Getting the image from image list
Bitmap bmp = new Bitmap(this.imageList1.Images[0]);
// Creating the custom tool bar
ChartToolBarDropDown dropdown = new ChartToolBarDropDown();
dropdown.Image = bmp;
//Added the custom toolbar into chart tool bar
this.chartControl1.ToolBar.Items.Add(dropdown);
// Created the custom menu
MenuItem item1 = new MenuItem("PrimaryXAxis", new EventHandler(Item_Click1));
item1.Checked = true;
item1.Name = "Checked";
MenuItem item2 = new MenuItem("PrimaryYAxis", new EventHandler(Item_Click1));
item2.Checked = true;
item2.Name = "Checked";
dropdown.Menu.MenuItems.Add(item1);
dropdown.Menu.MenuItems.Add(item2);
}
|
Please find the output of the sample below
The GridControl have the default support to add the ContextMenuStrip to the grid. The ContextMenuStrip property can be used to add the ContextMenuStrip to the grid. We have created a simple sample as per your scenario. Please refer to below code and sample,
Code snippet
|
//To add the toolstrip items to the ContextMenuStrip
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.copyToolStripMenuItem,
this.pasteToolStripMenuItem,
this.cutToolStripMenuItem});
//To add the context menu to grid
this.gridControl1.ContextMenuStrip = this.contextMenuStrip1; |
Screenshot
Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/ContextMenu1681774086
Please let us know if you have any concern.
Regards,
Saravana Kumar K.
TC
Travis Chambers
November 15, 2017 04:10 AM UTC
Thank you so much! This looks great and i will try it out soon.
SK
Saravana Kumar Kanagavel
Syncfusion Team
November 16, 2017 09:11 AM UTC
Hi Travis,
Thanks for your update.
Please let us know if you need any other assistance on this.
Regards,
Saravana Kumar K.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
TC Travis Chambers
- Nov 11, 2017 02:59 PM UTC
- Nov 16, 2017 09:11 AM UTC