xaml DockPanel
示例
DockPanel根据停靠属性(在控件中放置的顺序)对齐控件。
注意:DockPanel是WPF框架的一部分,但不随Silverlight/WinRT/UWP一起提供。开源实现很容易找到。
<DockPanel LastChildFill="False"> <!-- This will strech along the top of the panel --> <Button DockPanel.Dock="Top" Content="Top"/> <!-- This will strech along the bottom of the panel --> <Button DockPanel.Dock="Bottom" Content="Bottom"/> <!-- This will strech along the remaining space in the left of the panel --> <Button DockPanel.Dock="Left" Content="Left"/> <!-- This will strech along the remaining space in the right of the panel --> <Button DockPanel.Dock="Right" Content="Right"/> <!-- Since LastChildFill is false, this will be placed at the panel's right, to the left of the last button--> <Button DockPanel.Dock="Right" Content="Right"/> </DockPanel>
<!-- When lastChildFill is true, the last control in the panel will fill the remaining space, no matter what Dock was set to it --> <DockPanel LastChildFill="True"> <!-- This will strech along the top of the panel --> <Button DockPanel.Dock="Top" Content="Top"/> <!-- This will strech along the bottom of the panel --> <Button DockPanel.Dock="Bottom" Content="Bottom"/> <!-- This will strech along the remaining space in the left of the panel --> <Button DockPanel.Dock="Left" Content="Left"/> <!-- This will strech along the remaining space in the right of the panel --> <Button DockPanel.Dock="Right" Content="Right"/> <!-- Since LastChildFill is true, this will fill the remaining space--> <Button DockPanel.Dock="Right" Content="Fill"/> </DockPanel>
热门推荐
10 朋友新年祝福语大全 简短
11 新年祝福语简短大方兔年
12 搬新家礼物祝福语简短
13 同学见面花束祝福语简短
14 五一假期祝福语幽默简短
15 离职欢送敬酒祝福语简短
16 对学弟的祝福语简短
17 考老师辞职祝福语简短
18 祝福语驱散霉运的话简短