I have a databound ListBox with an ItemTemplate, following this example:
<ListBox ItemsSource="{Binding Path=FlightHeadings}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Path=Identifier}" />
<TextBlock Text="{Binding Path=Name}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
The ItemsSource databinding works; the ListBox displays all the items in the FlightHeadings property of the context.
However, the ItemTemplate is ignored. Instead of displaying each item as consisting of two TextBlocks, each item is instead displayed simply as its ToString() representation.
FWIW, I'm running Silverlight 4.0 on VS 2010, serving the test page with Cassini. I suspect I'm missing something very simple in the above XAML but I can't tell what it is; any advice would be greatly appreciated.