Укажите ControlTemplate для ItemsControl.ItemContainerStyle
Следующее похоже на то, что я пытаюсь выполнить. Однако я получаю ошибку
Неверное значение PropertyDescriptor.
на шаблонеSetter
, Я подозреваю, что это потому, что я не указалTargetType
дляStyle
; Тем не менее, я не знаю тип контейнера дляItemsControl
.
<ItemsControl>
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<StackPanel>
<TextBlock Text="Some Content Here" />
<ContentPresenter />
<Button Content="Edit" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ItemsControl.ItemContainerStyle>
<!-- heterogenous controls -->
<ItemsControl.Items>
<Button Content="Content 1" />
<TextBox Text="Content 2" />
<Label Content="Content 3" />
</ItemsControl.Items>
</ItemsControl>