Event registration in class initializer
Posted: Wed Aug 16, 2023 9:04 pm
Hi Robert,
this code is valid (and I'm using it frequently):
but unfortunately this code does not compiles:
It gives several error messages, like
Could it be possible to make this also work, please?
Thank you very much!
Wolfgang
this code is valid (and I'm using it frequently):
Code: Select all
oMenuItem := MenuItem{}{ Header := "Exit", Command := ExitCommand}
Code: Select all
oMenuItem := MenuItem{}{ Header := "Exit", Click += FileExit }
Code: Select all
error XS1922: Cannot initialize type 'System.Windows.Controls.MenuItem' with a collection initializer because it does not implement 'System.Collections.IEnumerable'
Thank you very much!
Wolfgang