Is there a way to know the parent window when an object instance is placed on a Window?
I see from debug the object has a ownerWindow property, but this is private.
TrueWindow
TrueWindow is a RectControl property.
My object is not a RectControl.
There is no way AFAIK if the class is not a subclass of Control or ContainerControl unless you program it yourself.
But why drag an instance of a class onto a window when it is not a Control. I would create a property in the window holding the instance, then creating it in the window’s Open event. Make the Constructor of the class take a window instance argument.
Because the class Im designing provides a couple of custom events and dragging it to the window make it easier to implement them. I could make it a Control subclass then, but I was trying to left the ability to instantiate it on the fly using AddHandler if needed to wire the custom events.
Btw, I see that making it a Control subclass, it can be also instantiated by code, and it gets a valid Window property depending on which window is instantiated (if its instantiated from a Window).
Besides getting no Handle, which I dont need, is a such instance valid?
Yes, the only drawback in my experience is that you can not inherit from another class.