DockPanel为容器控件.主要了解其Dock属性和LastChildFill属性的使用

下面以代码示例

1.
wpf学习笔记---DockPanel<DockPanel LastChildFill="True">
wpf学习笔记---DockPanel    
<Button DockPanel.Dock="Top">Top</Button>
wpf学习笔记---DockPanel    
<Button DockPanel.Dock="Bottom">Bottom</Button>
wpf学习笔记---DockPanel    
<Button DockPanel.Dock="Left">Left</Button>
wpf学习笔记---DockPanel    
<Button DockPanel.Dock="Right">Right</Button>
wpf学习笔记---DockPanel    
<Button>Fill</Button>
wpf学习笔记---DockPanel
</DockPanel>
wpf学习笔记---DockPanel
wpf学习笔记---DockPanel

wpf学习笔记---DockPanel

2.调整顺序后的变化

wpf学习笔记---DockPanel<DockPanel LastChildFill="True">
wpf学习笔记---DockPanel    
<Button DockPanel.Dock="Left">Left</Button>
wpf学习笔记---DockPanel    
<Button DockPanel.Dock="Right">Right</Button>
wpf学习笔记---DockPanel    
<Button DockPanel.Dock="Top">Top</Button>
wpf学习笔记---DockPanel    
<Button DockPanel.Dock="Bottom">Bottom</Button>
wpf学习笔记---DockPanel    
<Button>Fill</Button>
wpf学习笔记---DockPanel
</DockPanel>
wpf学习笔记---DockPanel

wpf学习笔记---DockPanel

3.当LastChildFill属性为Flase时的变化

wpf学习笔记---DockPanel  <DockPanel LastChildFill="False">
wpf学习笔记---DockPanel    
<Button DockPanel.Dock="Left">Left</Button>
wpf学习笔记---DockPanel    
<Button DockPanel.Dock="Right">Right</Button>
wpf学习笔记---DockPanel    
<Button DockPanel.Dock="Top">Top</Button>
wpf学习笔记---DockPanel    
<Button DockPanel.Dock="Bottom">Bottom</Button>
wpf学习笔记---DockPanel    
<Button>Fill</Button>
wpf学习笔记---DockPanel  
</DockPanel>

wpf学习笔记---DockPanel

结束

相关文章: