WPF ItemsPresenter

Sam of Simple Samples 5,541 Reputation points
2024-03-24T03:38:34.23+00:00

In the following XAML:

<Window.Resources>
	<ControlTemplate x:Key="ListTemplate">
		<Grid>
			<ItemsPresenter TextBlock.Foreground="Blue"/>
		</Grid>
	</ControlTemplate>
</Window.Resources>
<Grid>
	<ListBox Name="listCars" DisplayMemberPath="Model"
				Template="{StaticResource ListTemplate}"/>
</Grid>

I do not understand why the ItemsPresenter specifies a TextBlock. Where does the documentation explain that?

XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
808 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.