Enable submenus item in context menu on mouse hower

7 posts, 0 answers
  1. asif
    asif avatar
    12 posts
    Member since:
    Aug 2006

    Posted 03 Feb 2011 Link to this post

    Hi,
    i have a sub menu items in one of the menu items in context menu,but the problem is that submenu item doesnt get highlited or respond until i explicitly click on its parent item.
    Is there any possibility that i take mouse on the parent menu item and its children gets highlited,
    i dont want to click the parent to gets its children enabled.

  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 03 Feb 2011 Link to this post

    Hello,

    I am unsure as to the issue. The RadMenuItems will open the sub menus when you hover over them which is the desired way a context menu should perform. I have included a small samepl for you below. If this is not what you mean, then please let me know and I'll do my best to help.

    Designer File
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Partial Class Form1
        Inherits System.Windows.Forms.Form
      
        'Form overrides dispose to clean up the component list.
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try
                If disposing AndAlso components IsNot Nothing Then
                    components.Dispose()
                End If
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub
      
        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
      
        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.components = New System.ComponentModel.Container()
            Me.RadMenuButtonItem2 = New Telerik.WinControls.UI.RadMenuButtonItem()
            Me.object_c5bf45d1_94b0_4741_bdc0_e16134810595 = New Telerik.WinControls.UI.RadButtonElement()
            Me.RadLabel1 = New Telerik.WinControls.UI.RadLabel()
            Me.RadContextMenuManager1 = New Telerik.WinControls.UI.RadContextMenuManager()
            Me.RadContextMenu1 = New Telerik.WinControls.UI.RadContextMenu(Me.components)
            CType(Me.RadLabel1, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.SuspendLayout()
            '
            'RadMenuButtonItem2
            '
            Me.RadMenuButtonItem2.AngleTransform = 90.0!
            Me.RadMenuButtonItem2.AutoSize = True
            Me.RadMenuButtonItem2.FlipText = True
            Me.RadMenuButtonItem2.Name = "RadMenuButtonItem2"
            Me.RadMenuButtonItem2.Text = "kind of medium"
            Me.RadMenuButtonItem2.TextOrientation = System.Windows.Forms.Orientation.Vertical
            '
            'object_c5bf45d1_94b0_4741_bdc0_e16134810595
            '
            Me.object_c5bf45d1_94b0_4741_bdc0_e16134810595.Name = "object_c5bf45d1_94b0_4741_bdc0_e16134810595"
            '
            'RadLabel1
            '
            Me.RadLabel1.Location = New System.Drawing.Point(38, 38)
            Me.RadLabel1.Name = "RadLabel1"
            Me.RadContextMenuManager1.SetRadContextMenu(Me.RadLabel1, Me.RadContextMenu1)
            Me.RadLabel1.Size = New System.Drawing.Size(173, 16)
            Me.RadLabel1.TabIndex = 0
            Me.RadLabel1.Text = "Right Click Me For Context Menu"
            '
            'Form1
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.BackColor = System.Drawing.Color.White
            Me.ClientSize = New System.Drawing.Size(243, 144)
            Me.Controls.Add(Me.RadLabel1)
            Me.Name = "Form1"
            Me.Text = "Form1"
            CType(Me.RadLabel1, System.ComponentModel.ISupportInitialize).EndInit()
            Me.ResumeLayout(False)
            Me.PerformLayout()
      
        End Sub
        Friend WithEvents RadMenuButtonItem2 As Telerik.WinControls.UI.RadMenuButtonItem
        Friend WithEvents object_c5bf45d1_94b0_4741_bdc0_e16134810595 As Telerik.WinControls.UI.RadButtonElement
        Friend WithEvents RadLabel1 As Telerik.WinControls.UI.RadLabel
        Friend WithEvents RadContextMenuManager1 As Telerik.WinControls.UI.RadContextMenuManager
        Friend WithEvents RadContextMenu1 As Telerik.WinControls.UI.RadContextMenu
      
      
    End Class

    Form1.VB
    Imports Telerik.WinControls.UI
      
      
      
    Public Class Form1
      
      
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      
      
      
            Me.RadContextMenu1.Items.Add(New RadMenuItem("Level 1 - 1"))
            Me.RadContextMenu1.Items.Add(New RadMenuItem("Level 1 - 2"))
            Me.RadContextMenu1.Items.Add(New RadMenuItem("Level 1 - 3"))
            Me.RadContextMenu1.Items.Add(New RadMenuItem("Level 1 - 3"))
      
            CType(Me.RadContextMenu1.Items(1), RadMenuItem).Items.Add(New RadMenuItem("Level 2 - 1"))
            CType(Me.RadContextMenu1.Items(1), RadMenuItem).Items.Add(New RadMenuItem("Level 2 - 2"))
        End Sub
      
      
      
    End Class

    Regards,
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. asif
    asif avatar
    12 posts
    Member since:
    Aug 2006

    Posted 04 Feb 2011 Link to this post

    Thanks for the reply Richards
    I implement your given code in the (context menu showing) function but the problem is that the sub items still remain disabled when i take the mouse on its parent item.
    I modified ur code like this.

     

    Private

     

     

    Sub RadSchdAppView_ContextMenuShowing(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.SchedulerContextMenuShowingEventArgs) Handles RadSchdAppView.ContextMenuShowinge.ContextMenu.Items.Add(New RadMenuItem("Level 1 - 1"))
    e.ContextMenu.Items.Add(
    New RadMenuItem("Level 1 - 2"))
    e.ContextMenu.Items.Add(
    New RadMenuItem("Level 1 - 3"))
    e.ContextMenu.Items.Add(
    New RadMenuItem("Level 1 - 3"))
    CType(e.ContextMenu.Items(1), RadMenuItem).Items.Add(New RadMenuItem("Level 2 - 1"))
    CType(e.ContextMenu.Items(1), RadMenuItem).Items.Add(New RadMenuItem("Level 2 - 2"))
    End sub

    please help me on this..


     

  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 04 Feb 2011 Link to this post

    Hello,

    Thanks for this, but I am not sure I understand your issue. Please could you provide a full sample (designer and form) that replicates your issue and I'll be happy to take a look at it for you
    Regards,
    Richard
  6. asif
    asif avatar
    12 posts
    Member since:
    Aug 2006

    Posted 04 Feb 2011 Link to this post

    I am working in radschedular context menu there are 5 items in my customized context menu and one of the items have submenu (childrens) in it. The (submenu) children item's mouse hower doesnt get enabled untill i explicitly click on its parent item.
    I want mouse hower property to get enabled when i take the mouse on its parent item.


    Here i m attaching my code.....

      Private Sub RadSchdAppView_ContextMenuShowing(ByVal sender As Object, ByVal Telerik.WinControls.UI.SchedulerContextMenuShowingEventArgs) Handles RadSchdAppView.ContextMenuShowing

    If (e.ContextMenu.Items.Count > 0) Then
                For i As Integer = e.ContextMenu.Items.Count - 1 To 3 Step -1
                    Dim item = e.ContextMenu.Items(i)
                    item.Visibility = Telerik.WinControls.ElementVisibility.Collapsed
                Next
            End If

            Dim lAppointmentStatus As New List(Of AppointmentStatusBO)
          
            ''MenuItem for Appointment .......
            'Dim Edit As RadMenuItem = New RadMenuItem()
            'Edit.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText
            'e.ContextMenu.Items.Insert(2, Edit)
            'Edit.Text = "Edit Appointment"
            'Edit.TextSeparatorVisibility = True

            Dim Status As RadMenuItem = New RadMenuItem()
            e.ContextMenu.Items.Insert(3, Status)
            Status.Text = "Appointment Status"

              Status.Items.Insert(0, new radmenuitem)
              Status.Items(i).Text = " Arrived"   
                
              Status.Items.Insert(0, new radmenuitem)
              Status.Items(i).Text = " Cancelled"   
                
                   
     
            Dim Eligibility As RadMenuItem = New RadMenuItem()
            e.ContextMenu.Items.Insert(4, Eligibility)
            Eligibility.Text = "Run Eligibility"

            Dim GoToChart As RadMenuItem = New RadMenuItem()
            e.ContextMenu.Items.Insert(5, GoToChart)
            GoToChart.Text = "Go To Chart"

            Dim StartPhysicalEncounter As RadMenuItem = New RadMenuItem()
            e.ContextMenu.Items.Insert(6, StartPhysicalEncounter)
            StartPhysicalEncounter.Text = "Start Physical Encounter"

            Dim StartPhoneEncounter As RadMenuItem = New RadMenuItem()
            e.ContextMenu.Items.Insert(7, StartPhoneEncounter)
            StartPhoneEncounter.Text = "Start Phone Encounter"

            Dim ViewDemographics As RadMenuItem = New RadMenuItem()
            e.ContextMenu.Items.Insert(8, ViewDemographics)
            ViewDemographics.Text = "View Demographics"

    End sub
     

  7. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 04 Feb 2011 Link to this post

    Hello,

    Thanks for clarifying this. From what I see of your code, you don't seem to be doing anything wrong. I've looked through the Public Issue tracking System and not found a related bug for it there, however, as far as I'm aware, this is an issue that Telerik will need to fix in an upcoming release.

    All the best
    Richard
  8. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 09 Feb 2011 Link to this post

    Hello,

    Richard, thank you for the community efforts.

    Asif, this is a known issue and we will address it in a future release. If more people ask for it, we will increase its priority in our ToDo list.

    All the best,
    Dobry Zranchev
    the Telerik team
    Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
Back to Top
UI for WinForms is Visual Studio 2017 Ready