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

RadChart ChartArea Cursor

7 Answers 141 Views
Chart
This is a migrated thread and some comments may be shown as answers.
cbossie
Top achievements
Rank 1
cbossie asked on 18 Apr 2011, 01:30 PM
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;
            }
        }






7 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 21 Apr 2011, 01:23 PM
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
0
Sachin Kumar
Top achievements
Rank 1
answered on 02 May 2011, 01:17 PM
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.
0
cbossie
Top achievements
Rank 1
answered on 02 May 2011, 01:56 PM
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!
0
Mayra
Top achievements
Rank 1
answered on 31 Oct 2011, 03:44 PM
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
0
Sia
Telerik team
answered on 03 Nov 2011, 02:51 PM
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 >>

0
Mayra
Top achievements
Rank 1
answered on 03 Nov 2011, 08:19 PM
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, 
0
Sia
Telerik team
answered on 08 Nov 2011, 04:46 PM
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 >>

Tags
Chart
Asked by
cbossie
Top achievements
Rank 1
Answers by
Sia
Telerik team
Sachin Kumar
Top achievements
Rank 1
cbossie
Top achievements
Rank 1
Mayra
Top achievements
Rank 1
Share this question
or