I see in the documentation for the BarItem.UpdateUI event that this event should be used only if certain conditions are met. Otherwise... It doesn''t suggest what event I should use.
I''d like to dynamically enable my XPMenu items in some sort of event handler, if possible. An "OnGetMenuState" event, or whatever, but I can''t find any such event. Is there one?
ADAdministrator Syncfusion Team July 9, 2004 01:09 PM
Can you post some more information on your requirements. Specifically, when do you want to want to enable the items in your Menu(s): For example is it when you click on the ParentBarItem?
TJTJJuly 9, 2004 03:05 PM
Here''s a typical scenario: I''ve got a lot of menu items that should be enabled
only if I have a file open. Right now I''m doing it like this:
this.MenuClose.UpdateUI += new EventHandler (MenuEnableIfFileOpen);
this.MenuPrint.UpdateUI += new EventHandler (MenuEnableIfFileOpen);
private void MenuEnableIfFileOpen (object sender, EventArgs e)
BarItem menu = sender as BarItem;
if (menu != null)
menu.Enabled = this.IsFileOpen;
But I''ve been looking for another event to use instead of UpdateUI.
The documentation for UpdateUI suggests using another technique in most cases,
but is vague on what that technique might be. I''m thinking of something like
"OnAboutToShowMenu", but I don''t think that exists...
Ah, but that won''t work if the menus (um, BarItems) are shown on a toolbar, will
it? Okay, now I understand why there isn''t such an event...
I think I''ll stay with the UpdateUI technique, then. No problem.