WPF Dockpanel first child uses remaining space
问题 In a window I have there is a list of DockPanel s to specify a couple of files. Each DockPanel has a TextBox (for the path) and a button (to browse for a file). I've recreated a simple WPF page to demostrate the problem here: <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="150" Height="22"> <DockPanel> <TextBox HorizontalAlignment="Stretch"/> <!-- path to file --> <Button Content="..." DockPanel.Dock="Right"