[WPF] Fix layout issue when replacing the root widget of a window

When replacing the root child of a window, the content was not
properly reallocated.