Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用xml显示图像_Xml_Image_Windows Phone - Fatal编程技术网

使用xml显示图像

使用xml显示图像,xml,image,windows-phone,Xml,Image,Windows Phone,我正在尝试使用xml来完成显示所有图像的简单任务。但我不能完全完成这项任务。请帮帮我… 我的xaml代码: <ScrollViewer> <ListBox x:Name="imglist" Loaded="imglist_Loaded"> <ListBox.ItemsPanel> <ItemsPanelTemplate>

我正在尝试使用xml来完成显示所有图像的简单任务。但我不能完全完成这项任务。请帮帮我…

我的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