Reputation: 2450
What is the significant difference between
Upvotes: 4
Views: 2764
Reputation: 5234
A ContentControl
is used to display a one piece of content and it stretches to fill its region. An ItemsControl
displays multiple items and will fill its region, but its items will occupy only the space they need.
Here's some simple code showing them both:
<GroupBox>
<ScrollViewer>
<ItemsControl
ItemsSource="{Binding}">
</ItemsControl>
</ScrollViewer>
</GroupBox>
<GroupBox >
<Border>
<ContentControl ContentTemplate="{StaticResource YourTemplate}" Content="{Binding}" />
</Border>
</GroupBox>
A ContentPresenter
is typically used in the ControlTemplate of a ContentControl and an ItemsPresenter
is used in the template of an ItemsControl. These are the places where content/items are added.
This is a very high-level answer to a high-level question. This can get you started, but you're going to need to spend some time researching these important controls to fully understand.
Upvotes: 7