1
语法问题我使用Silverlight 4,下面的XAML正常工作:的Silverlight:用于设置值
<UserControl.Resources>
<ItemsPanelTemplate x:Key="WrapPanelTemplate">
<toolkit:WrapPanel />
</ItemsPanelTemplate>
</UserControl.Resources>
<ItemsControl x:Name="restOfHits"
ItemsSource="{Binding RestOfHits}"
ItemsPanel="{StaticResource WrapPanelTemplate}"
ItemTemplate="{StaticResource FileTemplate}"
Width="500"
Margin="0,50,0,0"
/>
但是,由于以下原因VS抱怨:
<ItemsControl x:Name="restOfHits"
ItemsSource="{Binding RestOfHits}"
ItemTemplate="{StaticResource FileTemplate}"
Width="500"
Margin="0,50,0,0"
>
<ItemsControl.ItemsPanel>
<toolkit:WrapPanel />
</ItemsControl.ItemsPanel>
</ItemsControl>
错误:
Property 'ItemsPanel' does not support values of type 'WrapPanel'.
这是为什么?如果我不想使用资源,指定ItemsControl
应该使用WrapPanel
的正确方法是什么?