)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get the selected radial menuitem in the WinForms RadialMenu?

Platform: WinForms |
Control: RadialMenu |
Published Date: August 11, 2015 |
Last Revised Date: January 8, 2020

Show the text and index value of Selected RadialMenuItem

In RadialMenu, the text and index value of the selected menu item can be detected by handling the MouseUp event in the RadialMenuItem. The Text and Index property in the RadialMenuItem helps you to specify the text and index value of the RadialMenuItem.

C#

//Hooks the MouseUp event for the whole RadialMenu Items
foreach (Control item in this.radialMenu1.Controls)
{
    if (item is RadialMenuItem)
    {
        (item as RadialMenuItem).MouseUp += Form1_MouseUp;
    }
}
void Form1_MouseUp(object sender, MouseEventArgs e)
{
    if (sender is RadialMenuItem)
    {
        //Gets the index of the selected menu item.
        int index = (sender as RadialMenuItem).Index;
        //Gets the text of the selected menu item
        string selectedText = (sender as RadialMenuItem).Text;
   }
}

VB

'Hooks the MouseUp event for the whole RadialMenu Items
For Each item As Control In Me.radialMenu1.Controls
    If TypeOf item Is RadialMenuItem Then
        AddHandler TryCast(item, RadialMenuItem).MouseUp, AddressOf Form1_MouseUp
    End If
Next item
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs)
    If TypeOf sender Is RadialMenuItem Then
        'Gets the index of the selected menu item.
        Dim index As Integer = (TryCast(sender, RadialMenuItem)).Index
        'Gets the text of the selected menu item
        Dim selectedText As String = (TryCast(sender, RadialMenuItem)).Text
        End Select
    End If
End Sub

 

Text and index value of the selected menuitem

Figure 1: Text and index value of the Selected MenuItem displayed in the Selection log.

 

Samples:

C#: http://www.syncfusion.com/downloads/support/directtrac/140711/ze/RadialMenuSample-839463344

VB: http://www.syncfusion.com/downloads/support/directtrac/140711/ze/RadialMenuSample_VB-280762999

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon