views:

55

answers:

1

Hi,

Say I have a list of Employee IDs from one data source and a separate data source with a list of Employees, with their ID, Surname, FirstName, etc.

Is it possible in XAML only to get the Employee's name from the second data source and display it next to the ID, using something like this (with the syntax corrected)?..

<TextBlock x:Name="EmployeeID" Text="{Binding ID}"></TextBlock>
<TextBlock Grid.Column="1" DataContext="{StaticResource EmployeeList[**where ID = {Binding ID}**]}" Text="{Binding Surname}"/>

I'm thinking back to my days using XML and XSLT with XPath to achieve the kind of thing shown above. Is this kind of thing possible in XAML? Or do I need to 'denormalize' the data first in code, into one consolidated list?

It seems like it should be possible to do this simple task using XAML only, but I can't quite get my head around how you would switch the DataContext correctly and what the syntax would be to achieve this.

Is it possible, or am I barking up the wrong tree?

Thanks,

AT

A: 

I am not entirely sure, but you could try binding to the ID, and use a IValueConverter to get the other data, and then display the result.

Sdry