滚动查看器内的 bing 地图问题

发布于 2024-11-05 03:50:10 字数 448 浏览 6 评论 0原文

我有一个 bing 地图,它位于滚动查看器内以及一个列表框。

现在的问题是,当滚动查看器的内容向下滚动时,“Bing 地图呈现在位于滚动查看器上方(滚动查看器边界之外)的其他元素之上”

<TextBlock Text="some text" />
<ScrollViewer>
    <map:Map ... />
    <ListBox ... />
</ScrollViewer>

出了什么问题?这是一个已知的错误吗? 我试图在我的搜索结果列表框中包含一个小地图(与 Windows Phone bing 结果页面“本地”数据透视项相同)

一些观察: (1) 仅 bing 地图图块图像渲染在顶部(甚至图钉也不渲染) (2) 位于滚动查看器下方的元素(在 xaml 中)正确呈现在地图顶部!

谢谢

I have a bing map which is located inside a scrollviewer along with a listbox.

Now the problem is when the content of the scrollviewer is scrolled down, "Bing map is rendered on top of other elements which are located above scrollviewer (outside the boundary of scrollviewer)"

<TextBlock Text="some text" />
<ScrollViewer>
    <map:Map ... />
    <ListBox ... />
</ScrollViewer>

What is wrong? Is it a known bug?
I'm trying to include a small map in my search result list box (the same as windows phone bing result page 'local' pivot item does)

Some observations:
(1) only bing map tile images are rendered on top (not even pushpins)
(2) the elements that are located beneath the scrollviewer (in xaml) are correctly rendered on top of the map!

thank you

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

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

发布评论

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

评论(3

咿呀咿呀哟 2024-11-12 03:50:10

只是不要将地图放在滚动查看器中。

这也将防止应用程序内滚动出现问题。

Just don't put the Map in the scrollviewer.

This will also prevent issues with scrolling within the app.

小猫一只 2024-11-12 03:50:10

好吧,我终于找到了一个很好的解决方法,使它看起来很棒。
诀窍如下:

一。我们通过将以下行添加到页面/用户控件的构造函数来禁用 bing 地图图块图像:

map.Mode.Content.Visibility = System.Windows.Visibility.Collapsed;

二。在地图控件之前,我们添加一个与地图控件具有相同宽度和高度的元素:

<ScrollViewer>
    <Grid>
        <Image .../>
        <map:Map .../>
    </Grid>
    <ListBox ... />
</ScrollViewer>

三。现在我们为“Bing 静态地图 API”中的 Image 元素构建一个 BitmapImage:
http://msdn.microsoft.com/en-us/library/ff701724.aspx

var url = "<bing static map api url for my location and zoom level - without any pushpin>";
var uri = new Uri(url);
imgStaticMap.Source = new BitmapImage(uri);

这样:

  • 我们将拥有相同的地图(都是 bing 地图)
  • 静态地图通常显示在滚动栏中
  • 对于这种情况甚至更好,因为这样就不会出现我们的小地图上的加载效果(虽然有不可避免的加载效果)

OK, I finally found a good workaround for it which make's it look awesome.
Here is the trick:

ONE. we disable the bing map tile images by adding the following line to the constructor of the page/usercontrol:

map.Mode.Content.Visibility = System.Windows.Visibility.Collapsed;

TWO. Right before the map control we add a element with the same width and height as map control:

<ScrollViewer>
    <Grid>
        <Image .../>
        <map:Map .../>
    </Grid>
    <ListBox ... />
</ScrollViewer>

THREE. now we build up a BitmapImage for the Image element from "Bing static map API":
http://msdn.microsoft.com/en-us/library/ff701724.aspx

var url = "<bing static map api url for my location and zoom level - without any pushpin>";
var uri = new Uri(url);
imgStaticMap.Source = new BitmapImage(uri);

This way:

  • we will have the same map (both are bing maps)
  • the static map is show normally in the scroll bar
  • It's even kinda better for this case, because this way there woul'nt be a loading effect on our small map (while the has inevitable loading effect)
短叹 2024-11-12 03:50:10

我使用 JeffWilcox.Maps 组件来实现类似的目的。这个静态地图在 ScrollViewer 中工作得很好。

I use JeffWilcox.Maps component to similar purposes. This static maps works fine inside ScrollViewer.

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