I would argue that if a view model needs to know about a UI element then it really isn't a view model anymore. The whole purpose of MVVM is to separate the V from the VM. I suspect if you rethink what you're trying to do you'll come up with a solution that doesn't require this approach. The best place to start is by looking at what you need from the parent window. Do you need to be notified when something happens? If so then expose a method on your child view model that the parent can hook into to notify it when needed. Do you need extra data from the parent window? Why not have the parent window pass that information to the child as part of the view model (perhaps as an interface containing the data)? Do you need to have the child notify the parent about a change? Expose an event on the child view model. It really depends on what you are trying to do as to which approach you go with.
But let's suppose you really need the owner window. In a WPF Window you already have the Owner
property that tells you who the owner is. You don't need to expose yet another property for it. Note that the owner of a window generally isn't set until the window is shown so ideally you would wait until the Activated
event (?) is raised to do anything with the owner. You could, in the child window, then use the Owner
property of the child window to pass along whatever you need into the viewmodel of the child.