How to access controls parent's property in a style

徘徊边缘 提交于 2019-12-06 04:29:55

You should be able to use RelativeSource:

<Condition Property="{Binding Path=IsSelected, RelativeSource={RelativeSource TemplatedParent}}" Value="True" />

EDIT: Try a using a MultiDataTrigger instead of a MultiTrigger as well. Check this.

Anatolii Gabuza

ListView has separate SelectedItemTemplate. So you could use it.

To save you time, posting the syntax that worked for me and for OP: {Binding RelativeSource={RelativeSource AncestorType={x:Type ParentType}}, Path=ParentProperty}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!