Dynamic Menu Items bug

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
0
0

Dynamicly building a Menu structure is causing problems..
I cannot remove menuitems by code..

If I build up the menu and do a reload of the menu I am unable to delete the MenuItems and read the ‘new’ ones.
The Old ones are still there.

So I have a fixed MenuItem “mnuMain” and a fixed MenuItem “mnuManager”, in between I want to load Menuitem dynamicly.

So without loading I have ‘ Main – Manager’.
Then I insert Employee in between.. Menu.MenuItems.Add(new MenuItem(){Text=”Employee”};

I will end up with ‘ Main – Employee -Manager’, which is what I want.

Now when I want to remove ‘Employee’ I cannot do it by code.
MainMenuBar is of type ‘MenuBar’

List<MenuItem> mRemove = new List<MenuItem>();
for (int x=0;x<MainMenuBar.MenuItems.Count;x++)
            {
                if(MainMenuBar.MenuItems[x]!=mnuMain&&MainMenuBar.MenuItems[x]!=mnuManager)
                {
                    mRemove.Add(MainMenuBar.MenuItems[x]);
                }
 
            }
            foreach(MenuItem mI in mRemove)
            {
                MainMenuBar.MenuItems.Remove(mI);
            }

 

  • You must to post comments
0
0

Hi Michael,

this issue is fixed in the latest build (1.3.16).

A better way to remove menu items though is to call Dispose() on them.

Best regards
Frank

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
File Name Size
There are currently no files uploaded.
Maximum number of files 1, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json