This question is locked. New answers and comments are not allowed.
I am trying to get a context menu to display when I right-click on a datapoint in a BarSeries.
I am able to add a context menu to the entire Cartesian Chart, but I want my context menu to be specific to the selected DataPoint.DataItem.
I am also not sure how to get to the DataItem of the clicked point, as the below wont let me use DataPoint as the type.
I am able to add a context menu to the entire Cartesian Chart, but I want my context menu to be specific to the selected DataPoint.DataItem.
<
telerik:BarSeries
ItemsSource
=
"{Binding DataView, ElementName=GroupsDataSource}"
CombineMode
=
"Cluster"
ClipToPlotArea
=
"False"
AllowSelect
=
"True"
ShowLabels
=
"True"
MinWidth
=
"30"
Margin
=
"5,0"
>
<
telerik:RadContextMenu.ContextMenu
>
<
telerik:RadContextMenu
ItemClick
=
"GroupContextMenu_ItemClicked"
EventName
=
"MouseRightButtonUp"
>
<
telerik:RadMenuItem
x:Name
=
"rmiCodeBar"
Header
=
"View Code Breakout (Bar)"
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
x:Name
=
"rmiCodePie"
Header
=
"View Code Breakout (Pie)"
>
</
telerik:RadMenuItem
>
</
telerik:RadContextMenu
>
</
telerik:RadContextMenu.ContextMenu
>
I am also not sure how to get to the DataItem of the clicked point, as the below wont let me use DataPoint as the type.
private
void
GroupContextMenu_ItemClicked(
object
sender, RadRoutedEventArgs e)
{
RadMenuItem item = e.OriginalSource
as
RadMenuItem;
var actingOn = ((RadContextMenu)sender).GetClickedElement<DataPoint>();
switch
(item.Name)
{
// Create drill down charts based on what is selected
default
:
break
;
}
}