3
我遇到了實現我想要的佈局的問題。 這是我的代碼:使ComboBox伸展到可用空間的最大寬度和右對齊的父母
<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>
我想是有靠右的三個要素,在訂單標籤,組合框,按鈕。標籤和按鈕應該佔用儘可能多的空間需要,但我希望組合框佔用儘可能多的空間可能高達150像素。 當DockPanel未設置爲HorizontalAlignment = Right時,這種方法有效。
任何提示/解決方案?
謝謝。
哪裏擴展`DropDown`的OP想要? – ProfK 2017-10-27 09:49:44