Binding listview to a lookup table
I have a list view which is bound to a database table:
dataGrid1.ItemsSource = tmpTable.DefaultView;
I have in the xaml file a开发者_运维问答 text box which is bound to one of the columns of the data table tmpTable (ID):
<TextBlock Name="txtPath" Text="{Binding ID}"
The ID represents a full path in a lookup table called Input_Docs I need txtPath to present the actual path from the lookup table Input_Docs. How do I do that?
I think the easiest way of doing this would be to write a custom value converter which you can apply to txtPath
. The converter will then get the ID
value passed to it (I'm guessing that isn't a problem right now for you) and do the lookup in Input_Docs
returning the corresponding value which will then be displayed by txtPath
For more information on using converters have a look at IValueConverter, Binding Converter Example, Lookup Converter
I imagine the last URL will be most useful to you, but the other bits should give you an idea on the power of Converters.
I think the easiest way of doing this would be to write a custom value converter which you can apply to . I imagine the last URL will be most useful to you, but the other bits should give you an idea on the power of Converters.
精彩评论