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

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

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

相关文章: