如何从windows phone 8(C#和Xaml)中的文件夹中加载60个图像到stackpanel或Listbox中,当我点击特定按钮时,我会从另一个文件夹中加载另一个图像?
答案 0 :(得分:0)
以下是我用来列出图片的代码,
<ListBox SelectionMode="Single"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ItemsSource="{Binding ImageCollection}"
SelectedItem="{Binding SelectedImage}"
MinHeight="100">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Image Source="{Binding}" Width="50" Margin="5"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
这里,ImageCollection是
public static IEnumerable<Uri> ImageCollection { get; set; }
将包含你的形象Uri&#39>
希望这会有所帮助