如何在 Windows Phone 7 上并排显示图像?

发布于 2024-10-04 18:44:29 字数 174 浏览 0 评论 0原文

我的 wp7 应用程序将从网络获取一组图像 URL,编号未知 5-20。我想将它们并排放置,用户可以通过从右向左滑动来看到它们,只是看不到任何选择或任何内容。我设法将网址转换为图像,但不知道如何在内容面板上放置和显示。我尝试了 contentpanel.children.add(image) 但它不起作用并显示一张图像。我该怎么做?

My wp7 app will get an array of image URLs from the web , number unknown 5-20. I want to put them side by side and user could see them by swipeing right to left,just seeing no choosing or anything.I manage to convert urls to images but couldnt figure out how to put and show on contentpanel. I tried contentpanel.children.add(image) but it didn't work and showed one image. How should I do this ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小ぇ时光︴ 2024-10-11 18:44:29

有很多方法可以做到这一点。

这是一种方法:

<ScrollViewer HorizontalScrollBarVisibility="Auto">
    <StackPanel x:Name="mySP" Orientation="Horizontal" />
</ScrollViewer>

然后用图像填充 StackPanel。
这里填充了设备(或模拟器)上的所有图像。

var lib = new MediaLibrary();

foreach (var picture in lib.Pictures)
{
    BitmapImage bi = new BitmapImage();
    bi.SetSource(picture.GetImage());

    mySP.Children.Add(new Image { Source = bi });
}

There are lots of ways you could do this.

Here's one way:

<ScrollViewer HorizontalScrollBarVisibility="Auto">
    <StackPanel x:Name="mySP" Orientation="Horizontal" />
</ScrollViewer>

And then just populate the StackPanel with the the images.
Here's it being populated with all the images on the device (or emulator).

var lib = new MediaLibrary();

foreach (var picture in lib.Pictures)
{
    BitmapImage bi = new BitmapImage();
    bi.SetSource(picture.GetImage());

    mySP.Children.Add(new Image { Source = bi });
}
妥活 2024-10-11 18:44:29

aziz,Windows Phone 7 的 Silverlight Toolkit 中的 WrapPanel 是您的完美控件;
检查此处:http://silverlight.codeplex.com

aziz, perfect control for you is WrapPanel from Silverlight Toolkit for Windows Phone 7;
check here: http://silverlight.codeplex.com

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文