Wpf – How to align side by side in stackpanel

stackpanelwpfxaml

How can I have the button align beside the ComboBox ? I am not able to drag the button to the side of the ComboBox using designer.

<Expander.Content>
    <StackPanel>
        <ComboBox Name="cbProd" Height="30" IsEditable="True" FontSize="15" />
        <Button Name="btnAdd" Content="add" Click="btnAddProduct_Click" />

Best Answer

Just nest multiple layout containers like this:

<Expander.Content>
    <StackPanel Orientation="Vertical">
        <StackPanel Orientation="Horizontal">
            <ComboBox Name="cbProd" Height="30" IsEditable="True" FontSize="15" />
            <Button Name="btnAdd" Content="add" Click="btnAddProduct_Click" />
        </StackPanel>
        ... your other controls
    </StackPanel>
</Expander.Content>
Related Topic