Control's parented by resources...
Declaring a control in resources and then trying to parent it to a Popup later will result in an exception stating that the control already has a parent. In this scenario, there is no way to detect what the parent is and to remove it (I tried many different ways). The workaround was to wrap my control in a popup in the resources and then make my code either re-use that popup or just discard it in favour of my own by reparenting the control. As the control can identify the popup as its parent, this is easy to do.