WPF Content Presenter绑定父级内容的写法

//元素中写法
Content="{Binding RelativeSource={RelativeSource Self}, Path=PlacementTarget.Content}"

 //控件模板中写法

<Button>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource Self}, Path=Content}"></ContentPresenter>
</Button>

posted @ 2021-01-11 16:37  fate_WPF  阅读(607)  评论(0编辑  收藏  举报