wpf 模板绑定父对象

有两种方式可以实现在模板中元素绑定到父对象

1、<ContentPresenter Margin=”{TemplateBinding Padding}”/>

2、Color=”{Binding RelativeSource={RelativeSource TemplatedParent},
Path=Background.Color}”/>