In a WebForm I added menuitem object in a menubar and I have set, by designers, the properties ‘name’ and ‘Text’. When in my code i get the menuitem properties, the name property is null.
But if I add menuitem from code (and not by the designer) and i set (always by Code) the property ‘Name’, then it is not nothing.
Why is this?
Although this might look like an innocuous change, I’m not sure that changing the Windows Forms behaviour is a good idea.
I think the principle should be: keep Windows Forms behaviour unless there is a very good reason to change.
Examples of very good reasons:
Nope, need to correct myself. It’s not a bug, it’s the correct behavior – can see the same in WinForms. The (Name) property in the designer is the name of the object, not the name stored with the MenuItem instance.
I can log an enhancement to see if changing this creates problems.
Looks like a new (old) bug. The Name is not serialized in Designer.cs. It may be related to an intermittent bug that caused the loss of child menu item relationship when using the designer. This could be the reason – and we had not noticed this before.