Dynamic items added to start menu?

3 posts, 0 answers
  1. Matt
    Matt avatar
    10 posts
    Member since:
    Sep 2010

    Posted 20 Sep 2010 Link to this post

    I'm trying to populate the right site of the start menu on the rad ribbon bar with recently access documents. I see how I can load items into there, but how do I handle the events for the clicks if they are being added at run time? Here is my code for adding an item:



    Dim Item As New Telerik.WinControls.UI.RadMenuItem


    Item.Name =




    Item.Text =


    "This is a test menu item"



    So now how do I programaticly handle the click even for that menu item? Usually I add a click handler through the visual studio IDE for items that already exist... Any help would be appreciated!

  2. Bruce Cooley
    Bruce Cooley avatar
    2 posts
    Member since:
    Mar 2008

    Posted 21 Sep 2010 Link to this post

    I believe you can do the following in VB.

    In same place as your code to create the item, you should be able to do the following:
    Item.Click += new EventHandler(Item_Click);

    Then you can write the event handler similar to:
    void Item_Click(object sender, EventArgs e)
      //Your Code Here

    If not, in VS, you should be able to type Item.Click += and then hit tab twice and it should generate the event handler for you.  If you already have the event handler setup, you'll only need to replace Item_Click with the name of your event handler.
  3. DevCraft R3 2016 release webinar banner
  4. Stefan
    Stefan avatar
    2891 posts

    Posted 23 Sep 2010 Link to this post

    Hello guys,

    Thank you for writing.

    @Matt, please consider the following code snippet in order to subscribe to the click event of this item:
    Public Class Form1
        Friend WithEvents item As New Telerik.WinControls.UI.RadMenuItem
        Public Sub New()
            Item.Name = "TestItem"
            Item.Text = "This is a test menu item"
        End Sub
        Private Sub menuItemClick(ByVal sender As Object, ByVal e As EventArgs) Handles item.Click
            //do something
        End Sub
    End Class

    I hope you find this information helpful. Should you have any additional questions, do not hesitate to contact me.

    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
Back to Top