I have a class (class A) that contains a list (list A) and and integer (int A). I also have a listview that its itemssource is bound to "list A". The listitems have a template that shows the itmes content (bound to its properties). I also want the template to use "int A" and show it.
how can I bind something inside the template (which its datacontext is listItem), to the class that contains the list (or even to the list itself) ?
thanks, Yos.
If the List/Items do not have a reference to
class A
thats not possible, becuase the list could be refenrenced somewhere else too.You can add something like a
classA Owner {get;set;}
property to your objects in the list and set this toclass A
whenever a item is added to the list (theCollectionChanged
-event can handle that if you use anObservableCollection
).