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

RadContextMenu Exception

7 Answers 71 Views
GridView
This is a migrated thread and some comments may be shown as answers.
xu qing
Top achievements
Rank 1
xu qing asked on 27 Apr 2010, 02:15 AM
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:
http://cid-a5759b7233ce78ef.skydrive.live.com/self.aspx/.Public/SilverlightProject.zip
   Thanks.

7 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 27 Apr 2010, 08:45 AM
Hello xu qing,

You have to use both MouseRightButton events Up/Down. In MouseRightButtonDown you have to set e.Handled=true in order to get MouseRightButtonUp. Then in MouseRightButtonUp you open RadContextMenu like you do it in MouseRightButtonDown event handler.
This is needed because Silverlight context menu is opened on MouseRightButtonUp and if you don't handle it - then Silverlight context menu will open.

Let us know if you need more information.

Regards,
Hristo
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
xu qing
Top achievements
Rank 1
answered on 28 Apr 2010, 10:00 AM
Hi,
    I edit my code with the method you tell me.But the exception still happened.
    Below is my demo code:
    http://cid-a5759b7233ce78ef.skydrive.live.com/self.aspx/.Public/SSMPDemo.rar
    Only the code file UserManager.xaml and UserManager.xaml.cs changed.Other ware not edit anything.
0
Vlad
Telerik team
answered on 28 Apr 2010, 10:15 AM
Hello,

I've tried to run your application however after the login screen an exception is raised. Can you post more info on how to run properly this application>

All the best,
Vlad
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
xu qing
Top achievements
Rank 1
answered on 28 Apr 2010, 10:21 AM
1.You need to attach db to SQLServer 2008.The db File in the first zip package I send Last Time.The Url is:
http://cid-a5759b7233ce78ef.skydrive.live.com/self.aspx/.Public/SilverlightProject.zip
2.Edit the Web.Config File under Project SSMP.Web.The Node is "ConnectStr".Edit the DataSource,Catalog,UserId And Password,The account need to connect to db.
After that,You may login and see the main sceen.
0
Vlad
Telerik team
answered on 28 Apr 2010, 10:30 AM
Hello,

Please isolate the problem in a small application and send it via support ticket.

Greetings,
Vlad
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
xu qing
Top achievements
Rank 1
answered on 29 Apr 2010, 01:54 AM
I Send a support ticket and attach my demo code.
How to run my demo application,Please read the readme file in package.
Below is my demo code down url,you can down demo code from there,too.
http://cid-a5759b7233ce78ef.skydrive.live.com/self.aspx/.Public/RadContextMenuException.rar
0
Hristo
Telerik team
answered on 29 Apr 2010, 12:25 PM
Hi xu qing,

I've replied in your support ticket.

Greetings,
Hristo
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.
Tags
GridView
Asked by
xu qing
Top achievements
Rank 1
Answers by
Hristo
Telerik team
xu qing
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or