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

4 posts, 0 answers
  1. Noor hussain
    Noor hussain avatar
    20 posts
    Member since:
    Dec 2010

    Posted 01 Nov 2012 Link to this post

    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
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 05 Nov 2012 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Noor hussain
    Noor hussain avatar
    20 posts
    Member since:
    Dec 2010

    Posted 06 Nov 2012 Link to this post

    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
  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 08 Nov 2012 Link to this post

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