Within my ListView/GridView, properties for each of the items of the ItemsSource (of type ObservableCollection<Changelog>) are displaying correctly when using DisplayMemberBinding (and the IDE is showing the correct type, ProjectRound is indeed a property of Changelog).
However, when using this very simple CellTemplate, the 'row item' type is recognized as the type used in the DataContext of the whole UserControl that contains the ListView. And thus, the property is not found ("Unable to resolve the property 'ProjectRound' in data context of type 'namespace.vm'") , and ultimately not shown (both in the designer and at runtime).
Occurs with a Label as below, but also with a Textblock or an Image bound to a Bitmap property.
<ListView ItemsSource="{Binding Changelogs}">
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridViewColumn DisplayMemberBinding="{Binding ProjectRound}" />
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Label Content="{Binding ProjectRound}" ></Label>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
I tried setting the type in the DataTemplate:
<DataTemplate DataType="{x:Type models:Changelog}">
<Label Content="{Binding ProjectRound}" ></Label>
</DataTemplate>
The IDE likes it better and doesn't complain that the property can't be found, but still doesn't display anything.
I've looked into RelativeSource, but to no avail
RelativeSource={RelativeSource FindAncestor, AncestoryType={x:Type Changelog}}
Thanks!