开发者

Get Listbox properties from ListBoxItem datatemplate

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜