RadDropDownButton prevent close?

2 posts, 1 answers
  1. David A.
    David A. avatar
    126 posts
    Member since:
    Aug 2008

    Posted 13 Feb 2012 Link to this post

    I have a RadDropDownButton and am using the menum items as a checklist.  The problem is I would like to keep the drop down open until the button is clicked again to allow the user to select multiple items.

    Is this possible?

    Thank you,
  2. Answer
    Stefan avatar
    2911 posts

    Posted 16 Feb 2012 Link to this post

    Hi David,

    Thank you for writing.

    You can achieve the desired functionality by canceling the popup closing in the DropDownClosing event handler of DropDownButtonElement except when a flag raised in the MouseDown event of the DropDownButtonElement is true. Here is a sample:
    public Form1()
        foreach (RadMenuItem item in radDropDownButton1.Items)
            item.CheckOnClick = true;
        radDropDownButton1.DropDownButtonElement.MouseDown += new MouseEventHandler(DropDownButtonElement_MouseDown);
        radDropDownButton1.DropDownButtonElement.DropDownClosing+=new RadPopupClosingEventHandler(DropDownButtonElement_DropDownClosing);
    private bool preventClose = false;
    void DropDownButtonElement_MouseDown(object sender, MouseEventArgs e)
        if (radDropDownButton1.DropDownButtonElement.IsDropDownShown)
            preventClose = true;
    void DropDownButtonElement_DropDownClosing(object sender, RadPopupClosingEventArgs args)
        if (preventClose)
            preventClose = false;
        args.Cancel = true;

    I hope that you find this information helpful. Should you have any other questions, do not hesitate to contact us.
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top