This is a migrated thread and some comments may be shown as answers.

RadContextMenu with Bar Chart

3 Answers 96 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 25 Jan 2010, 03:55 AM
Hi:

I want to right-click a bar on a bar chart and have a context menu appear with items based upon the bar that is clicked.  I have the right-click working, but when I define the contextmenu inside the chart in the xaml, the chart disappears and the menu takes the entire space.  When I define the contextmenu in code, I cannot make it appear at all.  How should I do this?  The latter approach, creating the menu in code is preferred as the items will depend upon the bar that is right-clicked.

3 Answers, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 27 Jan 2010, 07:28 AM
Hello Terry,

Can you, please, provide a sample code on how you use the context menu and the RadChart?

Greetings,
Evtim
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
GINN KELVIN
Top achievements
Rank 1
answered on 04 Feb 2010, 07:57 PM
Hi

Even i wanted to know how we could attach the Context menu to the radchart. the problem that i am facing is what framework element to attach the context menu.

0
Terry
Top achievements
Rank 1
answered on 05 Feb 2010, 01:59 AM

What worked for me was to define the ContextMenu inside the RadChart:

        <telerikCharting:RadChart x:Name="RadChart1" > 
            <radNav:RadContextMenu.ContextMenu> 
              <radNav:RadContextMenu EventName="MouseLeftButtonUp" x:Name="Context_Menu" ItemClick="Context_Menu_ItemClick">  
                <radNav:RadMenuItem Header="Top Level KPI" /> 
                <radNav:RadMenuItem Header="Details" /> 
              </radNav:RadContextMenu> 
            </radNav:RadContextMenu.ContextMenu> 
        </telerikCharting:RadChart> 
 

You can clear and redefine the menu items from code if the context menu varies depending on what you click.

If you leave out EventName, right-click is supposed to trigger the context menu, but I think that only works with Telerik's SL4 beta.

Good luck!
Tags
Chart
Asked by
Terry
Top achievements
Rank 1
Answers by
Dwight
Telerik team
GINN KELVIN
Top achievements
Rank 1
Terry
Top achievements
Rank 1
Share this question
or