Hi,
I use the RadContentMenu Control to provide contentmenu in my application.I write my code follow the demo:
http://demos.telerik.com/silverlight/#GridView/RowContextMenu
When I run my code and click right mouse on GridView,the contextmenu is not the menu I defind,it's the default right menu of Silverlight.The content of menu is:"Silverlight(S)".
Then I use the MouseRightButtonDown Event of GridView to display RadContentMenu by Code.Follow is my event hand code:
private void GList_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
//open radcontentmenu
this.ConentMenu.IsOpen = true;
//disable default contentmenu
e.Handled = true;
}
Then I run my code and right mouse on GridView,the RadContentMenu displayed.After that,I write the Opened Event of RadContentMenu,Follow is my code:
private void ConentMenu_Opened(object sender, RoutedEventArgs e)
{
RadContextMenu menu = (RadContextMenu) sender;
//Get the selectRow
GridViewRow selectRow = menu.GetClickedElement<GridViewRow>();
if (selectRow != null)
{
//Set the selectRow as local select row
selectRow.IsSelected = true;
}
}
I run my code again,An Exception happend in the RadContextMenu Opend Event hand Code.The Expend is:Value is not within the expected range.
By the way,I create my project on VS2010 RTM with Silverlight4 and RadControl Q1 2010 SP1.
I find another problem about RadGridView control.when I drag a column toGroupPanel,There got a unhanded exception.The Exception is as same as the RadContextMenu.
When I create a new project only has RadGridView AND RadContextMenu,It can works,But I really don't know why the same worked in new project but not in the demo project.I think it may get exception when work with some controls in my demo code.And the new project has another problem.
Follow is my operation.
1.WhenRadGridView Loaded Data complete,Click the right mouse button on one row,theContextMenu Opened.
2.Afterstep 1,Click the right mouse button again,the default silverlight context menuOpened.And the RadContentMenu is still opened,too.I will attatch the image in this forum.
Below is my demo code:
Thanks.