This question is locked. New answers and comments are not allowed.
John Lurtz
Top achievements
Rank 1
John Lurtz
asked on 14 Oct 2009, 10:23 PM
Hello!
I am able to drop TreeView Items onto my RadCharts succesfully. My question is around dropping the items to a specific DataPoint in the Chart. For example, if I have a BarSeries RadChart with 3 columns(datapoints) if I drag and drop the TreeView item over column #2 am I able to realize that the drop happened on column #2 and not just on the ChartArea in General?
Thanks,
JL
I am able to drop TreeView Items onto my RadCharts succesfully. My question is around dropping the items to a specific DataPoint in the Chart. For example, if I have a BarSeries RadChart with 3 columns(datapoints) if I drag and drop the TreeView item over column #2 am I able to realize that the drop happened on column #2 and not just on the ChartArea in General?
Thanks,
JL
4 Answers, 1 is accepted
0
Hi John,
Yes, this is possible with our RadDragAndDropManager. You will need to set RadDragAndDropManager.AllowDrop property to true for Bar. You can use styles for this:
And make sure this style is applied:
Now set e.QueryResult to true in DropQuery event handler and you will be able to retrieve the Bar instance in the DropInfo event handler through e.Options.Destination. You can find more details about RadDragAndDropManager in this help topic.
Best regards,
Ves
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.
Yes, this is possible with our RadDragAndDropManager. You will need to set RadDragAndDropManager.AllowDrop property to true for Bar. You can use styles for this:
<Style x:Key="BarItemsStyle" TargetType="chart:Bar"> <Setter Property="dragDrop:RadDragAndDropManager.AllowDrop" Value="True" /> </Style>And make sure this style is applied:
DataSeries series = new DataSeries();
series.Definition = new BarSeriesDefinition() { ItemStyle = this.Resources["BarItemsStyle"] as Style };Now set e.QueryResult to true in DropQuery event handler and you will be able to retrieve the Bar instance in the DropInfo event handler through e.Options.Destination. You can find more details about RadDragAndDropManager in this help topic.
Best regards,
Ves
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
Lutz
Top achievements
Rank 1
answered on 20 Aug 2012, 12:36 PM
Hello Telerik,
Our code:
Private Sub SetDefinitionToChart(ByRef dataSeries As DataSeries, definition As ISeriesDefinition) dataSeries.Definition = definition Dim depObj As DependencyObject = CType(dataSeries.Definition, DependencyObject) RadDragAndDropManager.SetAllowDrop(depObj, True) RadDragAndDropManager.AddDropQueryHandler(depObj, AddressOf RadChart_Series_OnDropQuery) RadDragAndDropManager.AddDropInfoHandler(depObj, AddressOf RadChart_Series_OnDropInfo) End Sub Private Sub RadChart_Series_OnDropQuery(ByVal sender As Object, ByVal e As DragDropQueryEventArgs) End Sub
Do you have an idea, wath´s wrong with our code?
We are using the WPF RadChart, Version 2011.2.712.40 of the Telerik.Windows.Controls.Charting.dll.
In your answer in the previous post you talked only about finding the DataSeries, but the task is, to drop on a DataPoint. Please can you explain this in more detail?
Thanks,
Lutz
0
Hi Lutz,
The style, set to ItemStyle property of the BarSeriesDefinition will be applied to every Bar item in the series, so basically it covers this requirement -- the item will be dropped on a datapoint (bar in this example). Can you send us a small example, which reproduces the problem you are getting? This way we will be able to debug it locally and get back to you with our findings.
Best regards,
Ves
the Telerik team
The style, set to ItemStyle property of the BarSeriesDefinition will be applied to every Bar item in the series, so basically it covers this requirement -- the item will be dropped on a datapoint (bar in this example). Can you send us a small example, which reproduces the problem you are getting? This way we will be able to debug it locally and get back to you with our findings.
Best regards,
Ves
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Lutz
Top achievements
Rank 1
answered on 30 Aug 2012, 03:46 PM
Hello Telerik,
we support configurable charttypes, so we like to set the drop capability for all types at once.
Our solution is now:
It may look a little strange, to do this in the CreateItemStyleDelegate, but it works. We don´t find any other possibility to get the instances of type BaseChartItem etc.
Thank you
we support configurable charttypes, so we like to set the drop capability for all types at once.
Our solution is now:
Public Function RadChart_CreateItemStyle(ByVal item As Control, ByVal style As Style, ByVal point As DataPoint, ByVal dataSeries As DataSeries) As Style Dim newStyle As New Style(style.TargetType) newStyle.BasedOn = style
If TypeOf item Is BaseChartItem Or TypeOf item Is ChartLegendItem Or TypeOf item Is SelfDrawingSeries Then
RadDragAndDropManager.SetAllowDrop(item, True) RemoveHandler item.DragOver, AddressOf RadChart_SeriesItem_DragOver RadDragAndDropManager.RemoveDropQueryHandler(item, AddressOf RadChart_Series_OnDropQuery) RadDragAndDropManager.RemoveDropInfoHandler(item, AddressOf RadChart_Series_OnDropInfo)
AddHandler item.DragOver, AddressOf RadChart_SeriesItem_DragOver RadDragAndDropManager.SetAllowDrop(item, True) RadDragAndDropManager.AddDropQueryHandler(item, AddressOf RadChart_Series_OnDropQuery) RadDragAndDropManager.AddDropInfoHandler(item, AddressOf RadChart_Series_OnDropInfo) End If
Return newStyle End FunctionIt may look a little strange, to do this in the CreateItemStyleDelegate, but it works. We don´t find any other possibility to get the instances of type BaseChartItem etc.
Thank you