Insights about the use of dynamic container controls

container controls are very useful and i frequently need them dynamic at runtime.

a good thing is to create a class as example with name ContainerControlEx and set the super to ContainerControl

at other Container Controls set the super to ContainerControlEx

if you need to store or handle any container control store it as ContainerControlEx.
with this basic class you can easy arrange it in the ui, have general methods or events.
Example Property DynCC() As ContainerControlEx

with test on IsA … it is also possible to cast it to individual object
If cc IsA CCItem Then Var cc As CCItem = CCItem(cc)

and instead of addhandler, removehandler (chaos)
i use a timer event and react on property values as example if cc.DeleteMe Then RemoveFromList(cc)
i also arrange them in a timer event that gaps are closed and new cc get the last position.

I rely on heavy use of container controls in many of my apps. I find them very good for making your own controls made of multiple elements and just need one call to add them. They are also good for custom pages where you might want swap out a whole set of controls at the same time.

I always subclass my container controls so that I can do stuff like “ActivePage as CustomCC” or add functionality like CustomCC.WatchForGestures.

In this app I use container controls for buttons, groups of control, pages, custom “touch-friendly” listboxes, gesture recognition, alerts and custom keyboard for data entry.

Some placeholder stuff in there right now but it works.

1 Like

nice app to control the lights.

i think about to use them as hierarchy view with different view modes.
more or less because i can design each and they have buttons inside.
in my last app i need constantly rebuild the ui because the underlying data change.