I have made the following part of the interface
But when starting the application they change position and the following remains
the magnifying glass is an icon on a Button that is placed on a TextBox
The code of the three elements is the following made with Visual Studio in a window (WPF)
<TextBox x:Name="tbBusqueda" Height="30" Margin="0,10,197,0" TextWrapping="Wrap" Text="Ingrese su busqueda" VerticalAlignment="Top" VerticalContentAlignment="Center" HorizontalAlignment="Right" Width="230" GotFocus="tbBusqueda_GotFocus"/>
<Button x:Name="btnBuscar" Margin="535,10,0,0" VerticalAlignment="Top" Height="30" Click="btnBuscar_Click" BorderBrush="{x:Null}" HorizontalAlignment="Left" Width="30">
<ComboBox x:Name="cmbBuscarPor" HorizontalAlignment="Left" Text="Buscar por " Margin="210,10,0,0" VerticalAlignment="Top" Width="120" Height="30" VerticalContentAlignment="Center" SelectedIndex="0" HorizontalContentAlignment="Center">
<ComboBoxItem Visibility="Collapsed">Buscar por</ComboBoxItem>
<ComboBoxItem Content="Nombre" HorizontalContentAlignment="Center"/>
<ComboBoxItem Content="Apellido paterno" HorizontalContentAlignment="Center"/>
<ComboBoxItem Content="Puesto" HorizontalContentAlignment="Center"/>
</ComboBox>
With such a limited piece of XAML it is difficult, but I think your problem is that you are defining the positions by managing the margins, for example you tell the button to be 535 pixels from the left edge and the combobox to be 210.
This solution is not optimal, what I would do (there are a thousand solutions) is to place -in the area occupied by the 3 controls- a Grid and divide it using ColumnDefinitions in order to define the spaces.
With that you don't have to define unnecessary margins or worry about spaces, you just tell it how big each column is within the grid and you put the controls in the corresponding column and position within it.
All the best.