RadContextMenu with Bar Chart

4 posts, 0 answers
  1. Terry
    Terry avatar
    157 posts
    Member since:
    Jul 2009

    Posted 24 Jan 2010 Link to this post

    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.
  2. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 27 Jan 2010 Link to this post

    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.
  3. GINN KELVIN
    GINN KELVIN avatar
    1 posts
    Member since:
    Dec 2009

    Posted 04 Feb 2010 Link to this post

    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.

  4. Terry
    Terry avatar
    157 posts
    Member since:
    Jul 2009

    Posted 04 Feb 2010 Link to this post

    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!
Back to Top