RadChart ChartArea Cursor

8 posts, 0 answers
  1. cbossie
    cbossie avatar
    11 posts
    Member since:
    Jan 2006

    Posted 18 Apr 2011 Link to this post

    Hi,

    I am trying to do something pretty simple, I believe - I'd simply like to change the mouse cursor to a hand when the mouse is anywhere over a chart. I've tried several different thing, all with the same result: when the mouse enters the chart it does turn into a hand, but when it enters the actual area where the bars are (i.e. the actual "chart area"), the mouse changes back to an arrow.

    Am I missing something simple, or is this just an inherent part of the RadChart that I can't affect?

    Thanks to anyone for help!

    Craig

    First, I put the Cursor="Hand" in the chart XAML:

            <telerik:RadChart x:Name="rctChart" LegendStyle="{StaticResource ChartLegend}" 
                              PaletteBrushesRepeat="False" TitleStyle="{StaticResource ChartTitleLarge}"  Cursor="Hand" >                     
                <telerik:RadChart.DefaultView>
                    <telerik:ChartDefaultView>
                        <telerik:ChartDefaultView.ChartArea>
                            <telerik:ChartArea Cursor="Hand" />
                        </telerik:ChartDefaultView.ChartArea>
                    </telerik:ChartDefaultView>
                </telerik:RadChart.DefaultView>

            </telerik:RadChart>

    And I also tried it with MouseEnter and MouseLeave event handlers:



            private void rctChart_MouseEnter(object sender, MouseEventArgs e)
            {
                RadChart ct = sender as RadChart;
                if (ct != null)
                {
                    ct.Cursor = Cursors.Hand;
                    ct.DefaultView.ChartArea.Cursor = Cursors.Hand;
                }
            }

            private void rctChart_MouseLeave(object sender, MouseEventArgs e)
            {
                RadChart ct = sender as RadChart;
                if (ct != null)
                {
                    ct.Cursor = Cursors.Arrow;
                    ct.DefaultView.ChartArea.Cursor = Cursors.Arrow;
                }
            }






  2. Sia
    Admin
    Sia avatar
    745 posts

    Posted 21 Apr 2011 Link to this post

    Hello Craig Bossie,

    I should confirm that there is a problem when setting a cursor to the chart area. This problem is related to the zoom & scroll functionality.  There the cursor is changed to hand automatically. Please excuse us for the inconvenience caused. The issue is logged and your points are updated. 

    Greetings,
    Sia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Sachin Kumar
    Sachin Kumar avatar
    1 posts
    Member since:
    Jan 2010

    Posted 02 May 2011 Link to this post

    Try attaching an event handler to the ItemClick event of chart area. The telerik chart shows mouse cursor as hand if you attach an event handler to ItemClick event of chart area.
  4. cbossie
    cbossie avatar
    11 posts
    Member since:
    Jan 2006

    Posted 02 May 2011 Link to this post

    Thank you for the idea. I checked it out, but it looks like only the actual bars (i.e. in a bar chart) are changed to a finger. The Background still has an arrow when you're over it. Too bad!

    Thanks!
  5. Mayra
    Mayra avatar
    18 posts
    Member since:
    Oct 2011

    Posted 31 Oct 2011 Link to this post

    Can you please tell me how I will be able to change the cursor to a custom one( image or path) while the chart is in ScrollAndZoom Mode?

    Thanks in advance for the answer and I look forward to hear from you.

    Regards,
    Mayra
  6. Sia
    Admin
    Sia avatar
    745 posts

    Posted 03 Nov 2011 Link to this post

    Hello Mayra,

    The issue reported before is already fixed so you should be able to change the mouse cursor with one of the optional for Silverlight. Unfortunately there is no built-in support for custom cursors.

    Greetings,
    Sia
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  7. Mayra
    Mayra avatar
    18 posts
    Member since:
    Oct 2011

    Posted 03 Nov 2011 Link to this post

    Hello Sia,

    Thank you for the answer. Do you think you can please share an example on how we can be able to change the hand mouse to another mouse when zoom in (ScroolAndZoom)?

    Regards, 
  8. Sia
    Admin
    Sia avatar
    745 posts

    Posted 08 Nov 2011 Link to this post

    Hi Mayra,

    When you have enabled zooming & scrolling on your chart area it automatically changes its cursor to Hand to hint the user he can zoom using the selection rectangle. You can disable this selection rectangle by finding the DragZoomLayerControl, responsible for zooming & scrolling functionality, and disable its interactivity like this:
    void chartArea_Loaded(object sender, RoutedEventArgs e)
          var dragZoomLayer = RadChart1.ChildrenOfType<DragZoomLayerControl>().Single();
          dragZoomLayer.IsInteractive = false; // disable selection rectangle
          dragZoomLayer.Cursor = Cursors.IBeam;  //set different cursor
    }
    The method ChildrenOfType is an extension method defined in the Telerik.Windows.Controls namespace so make sure you add a using statement.

    Greetings,
    Sia
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top