This is a migrated thread and some comments may be shown as answers.

Get CommandBarButton from RadCommandBar

3 Answers 133 Views
CommandBar
This is a migrated thread and some comments may be shown as answers.
Matteo
Top achievements
Rank 1
Matteo asked on 11 Feb 2015, 02:19 PM
Hi,
I have a RadCommandBar with 3 CommandBarButton. I need to get this 3 button from the RadCommandBar. How can I do that?

Thanks

3 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 12 Feb 2015, 07:27 AM
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.

 
0
Matteo
Top achievements
Rank 1
answered on 12 Feb 2015, 11:23 AM
Thank you very much it'is what I'm looking for.

Regards,
Matteo
0
Matteo
Top achievements
Rank 1
answered on 12 Feb 2015, 11:24 AM
Thank you very much, it's what I'm looking for

Regards,
Matteo
Tags
CommandBar
Asked by
Matteo
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Matteo
Top achievements
Rank 1
Share this question
or