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

Handling a Drag and Drop and a PopUp simultaneously

2 Answers 77 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Sparky
Top achievements
Rank 1
Sparky asked on 15 Aug 2010, 06:59 AM
Hi All
I have a listbox and a pie chart and you can drag from the listbox to the chart to populate it with some default values.

The scenario I am trying to actually implement is this: When the user clicks on a pie segment, a popup/new window (ideally I would like to use a DialogWindow so once the user clicks on a segment, they will be forced to edit or cancel their edit) opens up and allows the user to change the underlying data of the segment. At the same time, if the user clicks and drags the pie segment, it is removed from the chart.

I am handling all the drag and drop and the ItemClick event. The problem is that ItemClick is fired when the mouse button is pressed, NOT when it is released - that is, it responds to MouseDown rather than MouseClick. Therefore I cannot implement this scenario because as soon as the user clicks, the popup is shown and they are unable to perform any drag and drop.

In short, I would like to click and edit or click and drag. I also tried using the MouseUp event, but this is fired all over the RadChart. I want this to only happen when the user clicks on just a pie segment and so far I cannot seem to find a working solution.

Is there anyway to get around this limitation. This functionality is a requirement for us, but so far we don't seem to have a clean solution for the problem. Hope the Telerik team can give us some ideas.

Thank you very much. We are using 2010 Q1SP2 and 2010Q2Beta.

2 Answers, 1 is accepted

Sort by
0
Vladimir Milev
Telerik team
answered on 19 Aug 2010, 08:30 AM
Hi Sparky,

This is a little tricky, but you may consider it:
void ChartArea_ItemClick(object sender, ChartItemClickEventArgs e)
{
    (e.OriginalSource as BaseChartItem).MouseLeftButtonUp += new MouseButtonEventHandler(MainPage_MouseLeftButtonUp);
}
void MainPage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
    (sender as BaseChartItem).MouseLeftButtonUp -= new MouseButtonEventHandler(MainPage_MouseLeftButtonUp);
}

Using this code you can subscribe to the mouse-up event for the particular item and perform your action there. Also, please note the clean-up code required in the second event handler.

Greetings,
Vladimir Milev
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
Sparky
Top achievements
Rank 1
answered on 19 Aug 2010, 01:42 PM
Thank you I will try it out and let you know. I was playing with the MouseUp but I didn't know exactly what object I need to attach it to - this seems plausible. Thank you.
Tags
Chart
Asked by
Sparky
Top achievements
Rank 1
Answers by
Vladimir Milev
Telerik team
Sparky
Top achievements
Rank 1
Share this question
or