Strange behavior in Menuitem object

0
0

Hi,

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?

Best regards,

Angelo

  • You must to post comments
0
0

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:

  • make the behaviour Web compatible
  • implement DataBinding (Windows Forms has some inexplicable shortcommings on this field; the “new” MVVM development model depends on DataBinding)
  • expand control features

 

  • You must to post comments
0
0

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.

Best,

Luca

  • You must to post comments
0
0

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.

Thank you!

Luca

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.