简体   繁体   English

Win10 UWP App,MapControl错误

[英]Win10 UWP App, MapControl error

* NB *注意 This is not a duplicate as suggested below - I have the necessary namespaces and the control works fine at runtime; 这不是下面建议的重复项-我具有必要的名称空间,并且该控件在运行时可以正常工作; however, I have the updated tools 1.1.1 installed already 但是,我已经安装了更新的工具1.1.1 NB * NB *

I'm putting together an MVVM Win10 UWP app using Prism 6 / Unity using the new Win10 MapControl, see basic XAML snippet below - I'm getting a design-time error; 我使用新的Win10 MapControl使用Prism 6 / Unity组合了MVVM Win10 UWP应用程序,请参见下面的基本XAML代码段-我遇到了设计时错误; "The TypeConverter for "Style" does not support converting from a string.": ““样式”的TypeConverter不支持从字符串转换。”:

<maps:MapControl Name="myMap"
    Style="Terrain">
</maps:MapControl>

I've Googled for hours and found nothing, My approach ties up with the MSDN documentation as well as every tutorial I can find. 我已经搜索了几个小时,却一无所获。我的方法与MSDN文档以及我能找到的每个教程都息息相关。

Any ideas as to how to fix this? 关于如何解决此问题的任何想法?

You should bind it using the static keyword. 您应该使用static关键字将其绑定。 Something like 就像是

<maps:MapControl Name="myMap"
    Style="{x:Static maps:MapStyle.Terrain}">
</maps:MapControl>

They are both in the namespace so "maps:" prefix should work. 它们都在名称空间中,因此“ maps:”前缀应该有效。

Or alternatively just us the numerical literal (which is harder to read though): 或者,也可以只使用数字文字 (虽然更难阅读):

<maps:MapControl Name="myMap"
    Style="4">
</maps:MapControl>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM