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

RibbonBar RasSplitButtonElement behaviour

2 Answers 63 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
AccSys
Top achievements
Rank 1
AccSys asked on 12 Mar 2012, 12:25 PM
Hi All,

I've got a WinForms app with a RadRibbonBar and various groups of buttons, which all work fine ... apart from one.  I've just added a Split button as I need to have additional options when "Previewing", but don't seem to be able to use the main button part as a normal Click event, without the sub-items showing, and clicking on the "Arrow" to show sub-items causes a click event on the main button as well.

Is there a way to stop the RadSplitButton from showing the dropdown of child items when clicking the "main surface" of the button (as this would be the normal action), and then ONLY show the sub-item collection when you click on the Arrow, as with Microsoft behaviour for the Ribbon Bar?

Thanks in advance,
Paul

2 Answers, 1 is accepted

Sort by
0
Accepted
AccSys
Top achievements
Rank 1
answered on 12 Mar 2012, 01:21 PM
For the benefit of anyone else who's having a similar issue, I've managed to sort this out now.  It's a bit of a workaround in places, but does the job.

You firstly need to manually bind to the events for ActionButton and ArrowButton:

ID_RIBBON_PREVIEW.ActionButton.Click += new EventHandler(ID_RIBBON_PREVIEW_Click);
ID_RIBBON_PREVIEW.ArrowButton.Click += new EventHandler(ID_RIBBON_PREVIEW_OPTION_Click);
ID_RIBBON_PREVIEW.DropDownOpening += new CancelEventHandler(ID_RIBBON_PREVIEW_DropDownOpening);

Then in the DropDownOpening() event use the following (more verbose than it needs to be):

void ID_RIBBON_PREVIEW_DropDownOpening(object sender, CancelEventArgs e)
{
    bool bArrowClicked = ((RadSplitButtonElement)sender).ArrowButton.IsPressed;
     
    if (!bArrowClicked)
        e.Cancel = true;
}

So unless you click the "Arrow" the dropdown menu isn't shown.

Hope this helps others :)
0
Stefan
Telerik team
answered on 13 Mar 2012, 03:20 PM
Hi,

I am writing to confirm that this is the correct approach to achieve the desired functionality. I am marking your post as an answer.
 
Regards,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
AccSys
Top achievements
Rank 1
Answers by
AccSys
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or