views:

261

answers:

1

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:

<ListBox 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

+1  A: 

List<> objects don't automatically report when a new item is added. Try using an ObservableCollection<> instead, and see if that helps.

Cameron MacFarland
Thanks! that worked wonders. Will post as answer as soon as i am permitted :)
TerrorAustralis