Silverlight 多列列表框
我需要创建一个如下格式的列表框Silverlight 多列列表框,silverlight,windows-phone-7,Silverlight,Windows Phone 7,我需要创建一个如下格式的列表框 [x] [x] ^ [x] [x] | [x] [x] | ----> this is a side scroll and the [x] are pictures [x] [x] | 我怎么做?这是我的代码 <controls:PanoramaItem Header="New one" Name="Pan1" > <ListBox Margin="0,
[x] [x] ^
[x] [x] |
[x] [x] | ----> this is a side scroll and the [x] are pictures
[x] [x] |
我怎么做?这是我的代码
<controls:PanoramaItem Header="New one" Name="Pan1" >
<ListBox Margin="0,0,-12,0" x:Name="NewTitlesListBox"
ItemsSource="{Binding NewPicturesLocal}"
SelectionChanged="NewListBoxSelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,20">
<Image Width="110" CacheMode="BitmapCache" Source="{Binding ThumbURL}"
Margin="12,0,9,0"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PanoramaItem>
我曾尝试使用网格(添加更多列)和数据模板来实现这一点,但没有找到解决方案。一个简单的解决方案是使用Silverlight工具包中的WrapPanel:
. 您必须为ListBox设置ItemsPanelTemplate才能使用WrapPanel。在我链接到的页面的评论中有一个例子。一个简单的解决方案是使用Silverlight工具包中的WrapPanel:
. 您必须为ListBox设置ItemsPanelTemplate才能使用WrapPanel。在我链接到的页面的评论中有一个这样的例子。使用Silverlight工具包中的WrapPanel将是我问题的解决方案
<controls:PanoramaItem Header="New one" Name="Pan1" >
<ListBox Margin="0,0,-12,0" x:Name="NewTitlesListBox"
ItemsSource="{Binding NewPicturesLocal}"
SelectionChanged="NewListBoxSelectionChanged">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,20">
<Image Width="110" CacheMode="BitmapCache" Source="{Binding ThumbURL}"
Margin="12,0,9,0"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PanoramaItem>
使用Silverlight工具包中的WrapPanel将是我问题的解决方案
<controls:PanoramaItem Header="New one" Name="Pan1" >
<ListBox Margin="0,0,-12,0" x:Name="NewTitlesListBox"
ItemsSource="{Binding NewPicturesLocal}"
SelectionChanged="NewListBoxSelectionChanged">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,20">
<Image Width="110" CacheMode="BitmapCache" Source="{Binding ThumbURL}"
Margin="12,0,9,0"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PanoramaItem>
很高兴您发布了解决方案。我相信这对其他人来说很方便。很高兴你发布了你的解决方案。我相信这对其他人来说很方便。