Get CommandBarButton from RadCommandBar

4 posts, 1 answers
  1. Matteo
    Matteo avatar
    5 posts
    Member since:
    Jan 2015

    Posted 11 Feb 2015 Link to this post

    Hi,
    I have a RadCommandBar with 3 CommandBarButton. I need to get this 3 button from the RadCommandBar. How can I do that?

    Thanks
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 12 Feb 2015 Link to this post

    Hello Matteo,

    Thank you for writing.

    Please refer to the following article explaining the structure of RadCommandBar: http://www.telerik.com/help/winforms/commandbar-structure.html.

    Here is also a sample code:
    foreach (CommandBarRowElement row in radCommandBar1.Rows)
    {
        foreach (CommandBarStripElement strip in row.Strips)
        {
            foreach (RadCommandBarBaseItem item in strip.Items)
            {
                if (item is CommandBarButton && item.Name == "MyButton123")
                {
                    //do smth
                }
            }
        }  
    }

    I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

    Regards,
    Stefan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Matteo
    Matteo avatar
    5 posts
    Member since:
    Jan 2015

    Posted 12 Feb 2015 in reply to Stefan Link to this post

    Thank you very much it'is what I'm looking for.

    Regards,
    Matteo
  5. Matteo
    Matteo avatar
    5 posts
    Member since:
    Jan 2015

    Posted 12 Feb 2015 in reply to Stefan Link to this post

    Thank you very much, it's what I'm looking for

    Regards,
    Matteo
Back to Top