将 Microsoft Bing 地图控件添加到滚动查看器并恢复窗口时未重新呈现

发布于 2025-01-10 19:27:42 字数 1015 浏览 0 评论 0原文

当在 ScrollViewer 中添加 Microsoft Bing 地图控件时,在初始加载中,地图将以整个可用窗口大小呈现,当我们最大化窗口时,地图将以新的可用大小呈现,这很好。如果我们再次恢复窗口大小,则地图不会重新渲染为新的可用大小,而是会启用 ScrollViewer 滚动条。此外,仅当将 VerticalScrollBarVisibility 和 Horizo​​ntalScrollBarVisibility 设置为“自动”时才会发生这种情况。

代码片段如下:

<ScrollViewer Padding="0"
          VerticalScrollBarVisibility="auto"
          HorizontalScrollBarVisibility="Auto">
<Grid>
    <m:Map CredentialsProvider="Add Bing map Key"
           Center="47.620574,-122.34942"
           ZoomLevel="4"></m:Map>
</Grid></ScrollViewer>

输出屏幕截图:

初始加载

Initial Load

最大化并恢复窗口后

最大化并恢复后窗口

有人可以帮我在最大化窗口后恢复窗口时重新渲染地图吗?

提前致谢。

When adding the Microsoft Bing Map control inside the ScrollViewer, in the initial load the map will render in the whole available window size and when we maximize the window, the map will be rendered for the new available size, it is fine. If we again restore the window size, then the map is not re-rendered for the new available size instead the ScrollViewer scroll bars will be enabled. Also, this happens only when setting the VerticalScrollBarVisibility and HorizontalScrollBarVisibility to "Auto".

The code snippet is provided below:

<ScrollViewer Padding="0"
          VerticalScrollBarVisibility="auto"
          HorizontalScrollBarVisibility="Auto">
<Grid>
    <m:Map CredentialsProvider="Add Bing map Key"
           Center="47.620574,-122.34942"
           ZoomLevel="4"></m:Map>
</Grid></ScrollViewer>

Output Screenshot:

Initial Load

Initial Load

After maximizing and restoring the window

After Maximizing and restoring the window

Anyone please help me to re-render the Map when restoring the window after maximized it?

Thanks in advance.

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

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

发布评论

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

评论(1

凌乱心跳 2025-01-17 19:27:42

您可能需要考虑使用 Bing Maps USP 地图控件而不是旧版 WPF 控件。 WPF 控件的功能非常有限,不再受支持。 UWP 控件得到积极维护,可以通过 XAML 岛在 WPF 应用程序中使用。它还有更多的特性和功能。

https://learn.microsoft.com/en-us /windows/uwp/maps-and-location/

https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/host-standard-control-with-xaml-islands" microsoft.com/en-us/windows/apps/desktop/modernize/host-standard-control-with-xaml-islands

You might want to consider using the Bing Maps USP map control instead of the legacy WPF control. The WPF control has very limited functionality and is no longer supported. The UWP control is actively maintained and can be used in WPF apps via a XAML island. It has a lot more features and functionalities as well.

https://learn.microsoft.com/en-us/windows/uwp/maps-and-location/

https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/host-standard-control-with-xaml-islands

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