Link to home
Start Free TrialLog in
Avatar of ChrisAllison
ChrisAllisonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

WPF Binding to a sub collection of custom objects in a class

Hi All

Im pretty impressed with the abilities of WPF, it looks far more capable than Windows Forms, however I am still finding my feet with its data binding abilities.

I have a custom object, a Project, each project is made up serveral other objects like contactor costs and milestones and delivery information. Each type of contractor will have serveral Milestones and there will be costs associated with each Milestone.

I would like to display a collection of Projects in a list box but in each ItemTemplate I would like to show a listbox showing the Milestone costs of the Building Contractor. Each Milestone is the same type of object but is made up of a Milestone property (walls complete) a date property (date when the walls are expected to be put up) and a Cost property (the wall costs x)

I would programatically access a milestone object as:

For each p as Project in Projects
For each M as Milestone in p
Listbox1.Items.Add(m.Milestone & "-" & m.Date)
Next
Next

Any ideas on how I can bind this to a listbox?

Happy to share more code if needs be

Thx

Chris
ASKER CERTIFIED SOLUTION
Avatar of bkokx
bkokx
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial