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

Dynamic menu text

1 Answer 58 Views
CommandBar
This is a migrated thread and some comments may be shown as answers.
David A.
Top achievements
Rank 1
David A. asked on 09 Jun 2011, 06:18 PM
Hi,

I have a CommandBarDropDownButton with several menuitems, several of which I am dynamically changing the text the the CBDropDownButton is clicked.  Several of our users are telling us that the text does not change until the second time they click on the CBDropDownButton.  I cannot duplicate this on my machine but I have seen it on others.  I am handling the click event of the CBDropDownButton and setting the menuitem text there. 

is there a better way to do this to ensure the user will see the dynamic menu item text immediately?

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivan Todorov
Telerik team
answered on 15 Jun 2011, 08:31 AM
Hello David A.,

Thank you for your question.

It is better to change the text of the items on the PopupOpening event to ensure that the text will be changed before the popup is shown. Here is a code sample that demonstrates this:
public Form1()
{
    InitializeComponent();
    this.commandBarDropDownButton1.DropDownMenu.DropDownOpening += new CancelEventHandler(DropDownMenu_DropDownOpening);
}
 
void DropDownMenu_DropDownOpening(object sender, CancelEventArgs e)
{
    UpdateItemsText();
}

I hope this helps. Feel free to ask if you have any additional questions.

Greetings,
Ivan Todorov
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
CommandBar
Asked by
David A.
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Share this question
or