20

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" />
Nasreddine
  • 36,610
  • 17
  • 75
  • 94
Alvin
  • 8,219
  • 25
  • 96
  • 177

2 Answers2

36

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>
SvenG
  • 5,155
  • 2
  • 27
  • 36
9

set the orientation property of the stackpanel to Horizontal

dnr3
  • 1,481
  • 13
  • 21