Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Aleksander Hribšek
|
Jul 28, 2010 - 5:56 AM
|
All the Buttons in my DropDown > PopupMenu are created dynamically. How can i write any events for theme? For example, Click?
|
|
Technical Support
|
Jul 28, 2010 - 6:25 AM
|
Please use the following code (this code example implemented in RibbonMDI sample):
ToggleButton tb = new ToggleButton();
tb.Text = document.Text;
tb.Tag = document;
tb.RadioGroupName = "MDISwitcher";
tb.PressedChanged += DocumentToggleButton_PressedChanged;
openDocumentsPopupMenu.Items.Add(tb);
private void DocumentToggleButton_PressedChanged(object sender, EventArgs e)
{
ToggleButton tb = (ToggleButton)sender;
if (tb.Pressed)
{
DocumentForm document = tb.Tag as DocumentForm;
if (document == null)
return;
document.Focus();
}
}
|
|