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

RadSplitButtonElement Question

1 Answer 150 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Kenneth Jackson
Top achievements
Rank 1
Kenneth Jackson asked on 12 Mar 2009, 01:48 PM
Here is a sample of a quick test project I made to represent the issue I am having ...

    public Form1()
    {
      InitializeComponent();

      RadSplitButtonElement btnAttachFileDocument;
      btnAttachFileDocument = new RadSplitButtonElement();
      btnAttachFileDocument.Text = "Attach File";
      btnAttachFileDocument.Click += new EventHandler(btnAttachFileDocument_Click);
      btnAttachFileDocument.DropDownOpened += new EventHandler(btnAttachFileDocument_DropDownOpened);
      RadLabelElement oMenuItem;

      oMenuItem = new RadLabelElement();
      oMenuItem.Text = "Cover Sheet";
      oMenuItem.Click += new EventHandler(oMenuItem_Click);
      btnAttachFileDocument.Items.Add(oMenuItem);

      oMenuItem = new RadLabelElement();
      oMenuItem.Text = "Master Waybill Doc";
      btnAttachFileDocument.Items.Add(oMenuItem);

      radRibbonBar1.CommandTabs[0].Items.Add(btnAttachFileDocument);

    }

    void oMenuItem_Click(object sender, EventArgs e)
    {
      this.Text = "Cover Sheet Clicked";
    }

    void btnAttachFileDocument_DropDownOpened(object sender, EventArgs e)
    {
      this.Text = "DropDown";
    }

    void btnAttachFileDocument_Click(object sender, EventArgs e)
    {
      this.Text = "Clicked";
    }

I have 2 issues .

 

Firstly I cannot get a seperate event when clicking the dropdown arrow of the button or when clicking the button itself.

I want to generate a default click event if the user clicks the button but if he opens the drop down I want to wait for him

to select the appropriate item from the list. At the moment I always get the click event when the dropdown opens. How

do I prevent this ?

 

Secondly , with the splitbutton control I can mouseover the dropdown arrow and button seperately and it highlights them
seperately . WIth the splitbuttonelement that I add to the ribbonbar however it always highlights it all as one control always
and I can only ever see the Image regardless of the textimage relation I setup . My text is always invisible ...

 

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 13 Mar 2009, 11:35 AM
Hi Kenneth Jackson,

Thank you for writing.

You can distinguish the events of the split button by subscribing to the Click events of the ActionButton and ArrowButton. For instance:

this.radSplitButton1.DropDownButtonElement.ArrowButton.Click += new EventHandler(ArrowButton_Click);  
this.radSplitButton1.DropDownButtonElement.ActionButton.Click += new EventHandler(ActionButton_Click); 

As to your other question, the split button highlights as a whole because there is a glitch with the theme for the RadRibbonBar. This is only a visual issue, split button functions in exactly the same way.
Please write back if you need further assistance.

Best wishes,
Victor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Kenneth Jackson
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or