WPF: Why shouldn't I use {TemplateBinding Margin} in ControlTemplate - is Margin meant only for element's containers?

和自甴很熟 提交于 2019-12-01 03:41:28

Your conclusion is right, if you look at the framework provided default templates you'll see that the Margin inside the template is bound to the Padding property of the control.

Margin is applied automatically by the layout system, inside a control template you should use Padding instead.

<Border x:Name="WrappingBorder" Margin="{TemplateBinding Padding}" ... />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!