List Recent Documents in Menu

4 posts, 0 answers
  1. Dave
    Dave avatar
    2 posts
    Member since:
    May 2008

    Posted 25 Nov 2009 Link to this post

    Hello,

    I was wondering if there are any examples of how to list recently opened documents by my app in the ribbon menu?  I am using C# .net 3.5.

    Thanks,
    Dave
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 30 Nov 2009 Link to this post

    Hello Dave,

    Creating a most recent documents list is a task which can depend on many things related to the application you develop. We do not have such an example since it would be nothing more that inserting items in the RadApplicationMenu items collection:

    RadMenuItem menuItem = new RadMenuItem();
    menuItem.Text = @"C:\Document.txt";
    this.radApplicationMenu1.RightColumnItems.Add(menuItem);

    Also when this happens depends entirely on the design and organization of your application. For instance, you can insert items in this collection each time the user opens a document and you can keep track of the last 10 opened documents etc.

    Regards,
    Deyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Matt
    Matt avatar
    10 posts
    Member since:
    Sep 2010

    Posted 20 Sep 2010 Link to this post

    So I understand this, but how do you handle the click event for that item since it is being dynamically created? Usually I use the IDE to handle adding click events, I don't know how to do it for dynamically added items.
  5. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 23 Sep 2010 Link to this post

    Hi Matt,

    Thanks for writing.

    You should programmatically subscribe to the MouseClick event in this case:
    Please refer to the code snipped below:

    RadMenuItem menuItem = new RadMenuItem();
    menuItem.Text = @"C:\Document.txt";
    menuItem.Click += new EventHandler(menuItem_Click);
    this.radApplicationMenu1.RightColumnItems.Add(menuItem);
    ...
    void menuItem_Click(object sender, EventArgs e)
    {
     //do some operation with this Sender
        if(((RadMenuItem)sender).Text==@"C:\Document.txt")
        {
          //open this file
        }
    }

    I hope this helps.

     

    Kind regards,
    Peter
    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