I have this BdlTabItem
which receives a parameter of type DockableUserControl
and would like to know if is it a bad practice to create a circular reference between the two by using uc.TabItem = this
and new BdlDockableWindow(this)
before the constructor finishes.
I know this behavior can be considered really bad with unmanaged native code (C++). So, even though I didn't have any warnings or errors, I ask here if I should do this or not.
public BdlTabItem(BdlTabControl parent, DockableUserControl uc, string title)
{
TabControlParent = parent;
UserControl = uc;
WindowParent = new BdlDockableWindow(this);
this.Content = UserControl;
UserControl.TabItem = this;
}
This is acceptable, but raises questions. Why is the tab item instantiating a new WindowParent
but the parent tab control doesn't have a reference to it? Or why isn't the window parent a property on the user control being passed in? Seems like the behavior should be elsewhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With