开发者

Get Listbox properties from ListBoxItem datatemplate

开发者 https://www.devze.com 2022-12-26 23:57 出处:网络
Is there a way开发者_JAVA技巧 to bind a property of the listboxitem to one of it\'s owning listbox? I want it in a template so I believe that rules out ElementName.Use the FindAncestor mode of the Bin

Is there a way开发者_JAVA技巧 to bind a property of the listboxitem to one of it's owning listbox? I want it in a template so I believe that rules out ElementName.


Use the FindAncestor mode of the Binding class. Like this:

{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBox}}, Path=YourProperty}

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号