This is somewhat to do with OnVisualParentChanged
. In the FrameworkElement.cs implementation, it does private void TryFireInitialized()
, which in turn will call protected virtual void OnInitialized(EventArgs e)
, so you could hook in there.
It does depend on what information you need to know. As far as I can tell, the only place to get notified that the parent is changing AND be able to access the old parent is OnVisualParentChanged (the old parent is passed in as the parameter). Otherwise any other place to hook in you will only be able to access the new parent, as it has already been changed.
You may also want to investigate some classes that inherit FrameworkElement and see if they expose any additional properties or methods that could help you.