【发布时间】:2012-01-04 13:47:58
【问题描述】:
祝大家新年快乐!感谢您阅读本文!
我在为 contentTemplate 定位动态内容时遇到问题,我有以下问题:
<TabControl ItemsSource="{Binding Cats}">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" FontSize="16" FontWeight="Bold"></TextBlock>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate>
<WrapPanel>
<ItemsControl ItemsSource="{Binding Products}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Name}" Height="25" Width="100"></Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</WrapPanel>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
itemsSource 绑定猫返回一个类别列表 并且在每个类别中都有一个属性返回产品列表
目前正在显示所有垂直堆叠的按钮,但我需要这些按钮来填充 wrapPanel。我正在寻找 contentTemplate 的插图:
任何想法将不胜感激!
【问题讨论】:
标签: wpf vb.net binding tabcontrol itemtemplate