views:

74

answers:

1

Hello:

I'm working on a simple WPF example and wanted to expand the example but I'm struggling, I'll explain some background first. I have three tables, people, addresses, and countries. As expected people live at an address, and addresses are located in a specific country.

I'm currently working through using a combo box as a lookup table when creating a new person so that I can select an existing address and it's working great so far. My addresses come out in the format "Street No., Street Name, Postal Code" by use of a ItemsControl.ItemTemplate in my combo box.

I would like to also include the country in the formatted address, however my address table contains just the FK into my countries table. Is it possible that I can reach into my countries table to grab the country name all inside the ItemsControl.ItemTemplate? OR is there a mechanism that I need to understand/research?

A: 

Silly me the solution was there all along since my address entity has access to its country through a property.

I simply added another textblock to my ItemsControl.ItemTemplate and bound it to Country.Name

<TextBlock Name="Country" Text="{Binding Path=Country.Name}" />
Matthew