DockPanel
很有意思控件往四周绕着进来,顺序为上下左右中,都是单排的。逆时针的一圈一圈的转到内部,这个东西想法很好,估计实际应用基本用不着。如果平行的容器比较多的时候应该有点用。实际用的比较多的应该是层层嵌套。(便宜了做网页设计的)。
这个布局,还可以顺便带着,复习一下java的布局,跟这几个容器的布局也很类似。这一点可见WPF布局是博采众长,最少flex,java都很像。
其他的容器都用过没举例子,鉴于java我也不精通。那就来搞个例子,记录在这里防止时间一到,忘记啦,那就可惜啦。
这里面还是有个“附加属性的问题”,细看之下DockPanel.Dock与ApplacationControlBar的Dock属性有何不同?嘿嘿,正好印证了DockPanel的本意“靠边站”。Dock=“true”不就是靠边站的意思吗?具体靠在哪边呢?请看:DockPanel.Dock='left',DockPanel.Dock='top'....。然也!细看DockPanel的属性,
<DockPanel>
<Button content='button1' DockPanel.Dock='top'></Button>
<Button content='button2' DockPanel.Dock='top'></Button>
<Button content='button3' DockPanel.Dock=“top” Margin=“10”></Button>
<Button content='button4' DockPanel.Dock='left'></Button>
<Button content='button5' DockPanel.Dock='Right'></Button>
<Button content='button6' DockPanel.Dock='bottom'></Button&
这个布局,还可以顺便带着,复习一下java的布局,跟这几个容器的布局也很类似。这一点可见WPF布局是博采众长,最少flex,java都很像。
其他的容器都用过没举例子,鉴于java我也不精通。那就来搞个例子,记录在这里防止时间一到,忘记啦,那就可惜啦。
这里面还是有个“附加属性的问题”,细看之下DockPanel.Dock与ApplacationControlBar的Dock属性有何不同?嘿嘿,正好印证了DockPanel的本意“靠边站”。Dock=“true”不就是靠边站的意思吗?具体靠在哪边呢?请看:DockPanel.Dock='left',DockPanel.Dock='top'....。然也!细看DockPanel的属性,
<DockPanel>
<Button content='button1' DockPanel.Dock='top'></Button>
<Button content='button2' DockPanel.Dock='top'></Button>
<Button content='button3' DockPanel.Dock=“top” Margin=“10”></Button>
<Button content='button4' DockPanel.Dock='left'></Button>
<Button content='button5' DockPanel.Dock='Right'></Button>
<Button content='button6' DockPanel.Dock='bottom'></Button&
