将 Microsoft Bing 地图控件添加到滚动查看器并恢复窗口时未重新呈现
当在 ScrollViewer 中添加 Microsoft Bing 地图控件时,在初始加载中,地图将以整个可用窗口大小呈现,当我们最大化窗口时,地图将以新的可用大小呈现,这很好。如果我们再次恢复窗口大小,则地图不会重新渲染为新的可用大小,而是会启用 ScrollViewer 滚动条。此外,仅当将 VerticalScrollBarVisibility 和 HorizontalScrollBarVisibility 设置为“自动”时才会发生这种情况。
代码片段如下:
<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>
输出屏幕截图:
初始加载
最大化并恢复窗口后
有人可以帮我在最大化窗口后恢复窗口时重新渲染地图吗?
提前致谢。
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
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要考虑使用 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