Binding list of objects to WPF ListView
Posted
by Dave Colwell
on Stack Overflow
See other posts from Stack Overflow
or by Dave Colwell
Published on 2010-04-20T05:48:45Z
Indexed on
2010/04/20
5:53 UTC
Read the original article
Hit count: 372
Hi all,
I have a list of objects which i want to bind to a ListView control in my WPF application.
The Objects have a DataTemplate already, so no need to define that.
The list of objects is a property in the codebehind file in the format list<object>
When i add one object programatically, it appears fine. But when i try to bind the ItemSource of the ListBox to the list of objects, nothing shows up.
I am using the following binding:
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=Portfolios}"
where the name of the property i am trying to bind to is Portfolios and exists on the parent window
© Stack Overflow or respective owner