0
votes

* 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 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; "The TypeConverter for "Style" does not support converting from a string.":

<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.

Any ideas as to how to fix this?

1
It's not a duplicate - I have the necessary namespaces and the control works fine at runtime; however, I have the updated tools 1.1.1 installed already and the problem is there. - Chuckle
please show more information about Terrain - Shahriar
"Terrain" is a one of the values from the mapstyles Enum. - Chuckle
Shahriar - I think you're just guessing now. "StaticResource" references other resources in the project, it's not going to solve this problem (and for completeness; yes, I did try it at your suggestion and, not surprisingly, it breaks the app) - Chuckle

1 Answers

0
votes

You should bind it using the static keyword. 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.

Or alternatively just us the numerical literal (which is harder to read though):

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