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}
精彩评论