I have a problem with the layout I want. This is my code:
<DockPanel DockPanel.Dock="Bottom" HorizontalAlignment="Right" LastChildFill="True">
<Label DockPanel.Dock="Left" Content="Add new:"/>
<Button DockPanel.Dock="Right" Content="Add" VerticalAlignment="Center"/>
<ComboBox VerticalAlignment="Center" MaxWidth="150" HorizontalAlignment="Stretch">
<System:String>Item1</System:String>
<System:String>Item2</System:String>
<System:String>Item3</System:String>
</ComboBox>
</DockPanel>
I want the three elements to be aligned to the right, in the shortcut Order, ComboBox, Button. The shortcut and button should take up as much space as necessary, but I want the ComboBox to occupy the maximum possible space of up to 150 pixels. This works when the DockPanel is not set to HorizontalAlignment = Right.
Any tips / solutions?
Thank.
source
share