在 xaml 中添加 MapControl 会导致“灾难性故障";

编程入门 行业动态 更新时间:2024-10-27 20:30:12
本文介绍了在 xaml 中添加 MapControl 会导致“灾难性故障";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在使用 Visual Studio Ultimate 2013 版本 12.0.30501.00 更新 2 创建一个通用应用程序.我在像这样在我的 xaml 中添加地图控件时遇到了灾难性的失败

I am creating an universal application using Visual Studio Ultimate 2013 Version 12.0.30501.00 Update 2. I am getting Catastrophic failure on adding Map Control in my xaml like this

<Maps:MapControl Visibility="Collapsed"/>. 

我已添加

xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps" 

在页眉中,并将位置"功能添加到应用程序清单文件中.有没有人遇到过同样的问题?您可以通过创建示例应用程序并仅添加 MapControl 来测试它.请帮我解决这个问题.

in the page header and added 'location' capability to application manifest file. Has anyone faced the same issue? You can test his by creating a sample application and add only MapControl. Please help me to resolve this issue.

在正常的 Windows Phone 8.1 应用程序中也会出现此问题.我在这里遗漏了什么吗?

The problem is observed in normal Windows Phone 8.1 applications also. Am i missing something here?

当我尝试在模拟器中运行应用程序时发现问题.

The problem is observed when i try to run the application in emulator.

错误没有显示任何其他信息,只是灾难性故障",没有别的.

The error does not show any other information just 'catastropic failure', nothing else.

也许我会尝试重新安装 Visual Studio.但一个更有趣的事实是,如果我没有在页面中隐藏地图控件,我可以让它工作.

May be i will try to re-install Visual Studio. But one more interesting fact is that i could get it working if i am not hiding the map control in the page.

您能否通过创建示例应用程序并仅制作地图控件 Visibility='Collapsed' 来测试它?

Can you test it by creating a sample application and just making the map control Visibility='Collapsed'?

<Page
    x:Class="TestMaps.MainPage"
    xmlns="http://schemas.microsoft/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft/winfx/2006/xaml"
    xmlns:local="using:TestMaps"
    xmlns:d="http://schemas.microsoft/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats/markup-compatibility/2006"
    xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps" 
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid>
        <Maps:MapControl Visibility="Collapsed" />
    </Grid>
</Page>

并且在不止一台 PC 上观察到该问题.

And the problem is observed in more than one PC.

推荐答案

我已经测试了您的示例,确实在我的手机上也存在这样的问题.

I've tested your example and indeed there is such a problem also on my Phone.

正如我所检查的,可以从代码中设置 Collapsed - 因此作为一种解决方法:

As I have checked it is possible to set Collapsed from code - so as a workaround:

<Grid>
   <Maps:MapControl Name="myMap" Visibility="Visible" />
</Grid>

在后面的代码中:

public MainPage()
{
    this.InitializeComponent();
    this.Loaded += (sender, e) => myMap.Visibility = Visibility.Collapsed;
}

这篇关于在 xaml 中添加 MapControl 会导致“灾难性故障";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-25 13:29:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117662.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:灾难性   故障   xaml   MapControl   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!