Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VS2010 .net4 wpf

Hi,

I have a dataset with several tables lets say Order and OrderItem, and a window whos datacontext is set to the OrderItem table.

The OrderItem has an OrderID field, but I dont want to display the OrderID, how can I display the OrderName from the Order table when the datacontext of the window is the OrderItem table?

It is working fine for Comboboxes as I can set the xaml as follows:
Set the ItemSource for the combobox to the Orders table
C#
SelectedValue="{Binding Path=OrderID}" // orderID from OrderLine 
DisplayMemberPath="OrderName" // orderName from order table
SelectedValuePath="OrderID" // orderID from order table

How can i get the same result with a text box, ie display the description knowing the ID?

Thanks,
Chas
Posted
Updated 9-Jul-11 3:06am
v2
Comments
DaveAuld 9-Jul-11 9:07am    
edit: wrapped code in pre block
dasblinkenlight 11-Jul-11 12:12pm    
Could you post the complete XAML for your textbox, and also for the combobox that works?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900