Make it like this:
<DockPanel LastChildFill="True"> <Button Content="..." DockPanel.Dock="Right"/> <!-- button to browse for file --> <TextBox DockPanel.Dock="Left" HorizontalAlignment="Stretch"/> <!-- path to file --></DockPanel>
If you don't want the behavior of DockPanel, don't use a DockPanel.
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <TextBox /> <Button Content="..." Grid.Column="1"/></Grid>