I have a ListBox that looks like this:
<ListBox ItemsSource="{StaticResource journal}" DisplayMemberPath="Title" />
When “Title” is a property, e.g:
public string Title { get; set; }
It displays fine, but if I make Title a public field instead, the ListBox only displays an empty string. This unfortunately makes it impossible to work with structs, since they don’t support properties.
Are there any workarounds to this?
The WPF Binding engine does not support public fields. You’d better create a ViewModel to show these items (with the appropiate properties) if they are structs.