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

How to know which commandbarstripelement items is clicked in itemclick event ?

3 Answers 145 Views
CommandBar
This is a migrated thread and some comments may be shown as answers.
Noor hussain
Top achievements
Rank 1
Noor hussain asked on 01 Nov 2012, 07:40 AM
Hi All,

Please let me know how to get the clicked item of the commandbarstripelement in item click event. Say if I have a button b in the commandbarstripelement row how to know that this particular button b  is clicked in item click event.

Thanks and regards,
Noor Hussain

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 05 Nov 2012, 03:13 PM
Hi Noor,

Thank you for writing.

To get the strip of the clicked item, you can use the FindAncestor method to find the strip in its element hierarchy:
void Form1_ItemClicked(object sender, EventArgs e)
{
    CommandBarDropDownButton btn = sender as CommandBarDropDownButton;
    if (btn != null)
    {
        CommandBarStripElement strip = btn.FindAncestor<CommandBarStripElement>();
    }
}

I hope this helps.

Kind regards,
Stefan
the Telerik team
Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Noor hussain
Top achievements
Rank 1
answered on 06 Nov 2012, 06:15 AM
Hi Stefan,

Thanks for your response. I want to know how to determine which button is clicked in the commandbarstripelement ? I have a few buttons in the strip, i want to know which particular button is clicked in this strip in the commandbarstripelement item click event.

Thanks and Regards,
Noor
0
Stefan
Telerik team
answered on 08 Nov 2012, 02:04 PM
Hello,

The sender is the particular item clicked. If you look at the code previously provided you will see that I am casting it to CommandBarDropDownButton and I have a reference to it.

I hope this helps.
 
All the best,
Stefan
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
CommandBar
Asked by
Noor hussain
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Noor hussain
Top achievements
Rank 1
Share this question
or