使用xml显示图像
我正在尝试使用xml来完成显示所有图像的简单任务。但我不能完全完成这项任务。请帮帮我…使用xml显示图像,xml,image,windows-phone,Xml,Image,Windows Phone,我正在尝试使用xml来完成显示所有图像的简单任务。但我不能完全完成这项任务。请帮帮我… 我的xaml代码: <ScrollViewer> <ListBox x:Name="imglist" Loaded="imglist_Loaded"> <ListBox.ItemsPanel> <ItemsPanelTemplate>
我的xaml代码:
<ScrollViewer>
<ListBox x:Name="imglist" Loaded="imglist_Loaded">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Image x:Name="img" Source="{Binding ImageUrl}" Width="160" Height="160"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
public class images
{
public ImageSource ImageUrl { get; set; }
}
类文件:
<ScrollViewer>
<ListBox x:Name="imglist" Loaded="imglist_Loaded">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Image x:Name="img" Source="{Binding ImageUrl}" Width="160" Height="160"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
public class images
{
public ImageSource ImageUrl { get; set; }
}
检查XML文件中的路径<代码>C:/Users/USER 1/Documents/Visual Studio 2012/Projects/pinchimage/pinchimage/在您的手机/模拟器上不存在。您应该为应用程序包中的图像资源或内容文件提供URI,或者为internet上的图像提供URL。IIRC,对于独立存储中的图像,您需要手动代理它们(尽管我可能错了)。请参见此链接,其中包含示例xml