-
Hey guys, I'm having a bit of trouble figuring out what the best way to create child UI elements is, other than using the constructor. I'm hoping to avoid the constructor so that I can take advantage of properties set in the object initializer on instantiation. To do this, I tried using |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
OnLoad/PreLoad are only called when the control is added to a window that is shown. They should theoretically work though as this where StackLayout and DynamicLayout creates their content. If you have a concrete example of what you're trying to do maybe I can help further. |
Beta Was this translation helpful? Give feedback.
-
Haha my apologies, I realised where I had gone wrong. I was putting the call to base.OnXXX() (which recurses the event to child controls) before I added the child controls. Essentially, I updated the children before there were any, so the call went nowhere. Bit of an annoying thing to debug but it wasn't anything from you guys! |
Beta Was this translation helpful? Give feedback.
Haha my apologies, I realised where I had gone wrong. I was putting the call to base.OnXXX() (which recurses the event to child controls) before I added the child controls. Essentially, I updated the children before there were any, so the call went nowhere. Bit of an annoying thing to debug but it wasn't anything from you guys!