Groupboxをスタックパネルにバインドしたい。
c#:
internal ObservableCollection<GroupBox> BindingTest
{
get
{
ObservableCollection<GroupBox> collection = new ObservableCollection<GroupBox>();
for (int counter = 0; counter < 5; counter++)
{
GroupBox groupBox = new GroupBox();
groupBox.Header = " ... Header ... ";
groupBox.Content = " ... Content ... ";
collection.Add(groupBox);
}
return collection;
}
}
およびxamlコード:
<StackPanel x:Name="Dynamic" Grid.Row="1" Margin="29,118,6,0">
<ItemsControl ItemsSource="{Binding Path=BindingTest}" Height="482">
<ItemsControl.ItemTemplate>
<DataTemplate>
<GroupBox>
<GroupBox.Header>{Binding Path=Header}</GroupBox.Header>
<GroupBox.Content>{Binding Path=Content}</GroupBox.Content>
</GroupBox>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
推論の誤りはどこにありますか?