You are blocking the Dispatcher, preventing the layout from being updated. When you open a Message Box, you push a nested message loop that allows the Dispatcher to continue processing its queue until the Message Box is closed. The layout updates are happening during that period.
The same thing happens when you call ShowDialog()
on a regular Window: your code blocks, but the Dispatcher keeps running so the UI updates as expected. Your code does not resume until the nested message loop is popped, which happens automatically when you close a modal dialog (like your Message Box).