<DockPanel LastChildFill="False">
<TextBox DockPanel.Dock="Bottom">Command: </TextBox>
<Button>
<Button.Content>Right Button</Button.Content>
<DockPanel.Dock>Right</DockPanel.Dock>
</Button>
</DockPanel>
看到了吗?假如把Attached Property, DockPanel.Dock使用Property Element来设置,而不是通过常规的XML 属性来赋值的话,是直接写在Element内部,并且不用使用Elememt作为前缀的(Button.DockPanel.Dock是错的!)
这也就解释了,Behavior是如何Attach到WPF的Element上的:
<Ellipse Canvas.Left="80" Canvas.Top="70" Fill="OrangeRed" Width="40" Height="70">
<i:Interaction.Behaviors>
<custom:DragInCanvasBehavior></custom:DragInCanvasBehavior>
</i:Interaction.Behaviors>
</Ellipse>