Remove DockPanel.Dock="Left"
from the ProgressBar
and switch the order of the controls:
<DockPanel>
<TextBlock DockPanel.Dock="Right" Height="23" VerticalAlignment="Top" HorizontalAlignment="Right"/>
<ProgressBar Height="23" VerticalAlignment="Top" />
</DockPanel>
By default, DockPanel
has its property LastChildFill
set to true
, which will make the ProgressBar
take the available space.