I have a list that has it ItemsSourceinstalled. ColumnMetadata- structure. I can easily get DisplayMemberPathto show the keys by setting it to "Key", but I canβt figure out how to make it show a member of my structure.
I tried setting DisplayMemberPathup "{Binding LocalizedColumn}", "Value.LocalizedColumn", "LocalizedColumn", "{Value.LocalizedColumn}", and none of them work. I just get a bunch of blank lines in my list.
All I want to do is get the data in the list. I am not interested in any updates back to the dictionary, and the dictionary will not be updated after filling out the list.
The code that I now activated at runtime:
lstDatabaseColumns.ItemsSource = ImportData.GetAddressFieldData
lstDatabaseColumns.DisplayMemberPath = "Value.LocalizedColumn"
lstDatabaseColumns.SelectedValuePath = "Key"
My structure looks like this:
Public Structure ColumnMetadata
Dim LocalizedColumn As String
Dim Description As String
End Structure
The following message appears in my output window:
System.Windows.Data Error: 40 : BindingExpression path error: 'LocalizedColumn' property not found on 'object' ''ColumnMetadata' (HashCode=1118531966)'. BindingExpression:Path=Value.LocalizedColumn; DataItem='KeyValuePair`2' (HashCode=-1578744570); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')