0

* 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?

rbrundritt
  • 16,570
  • 2
  • 21
  • 46
Chuckle
  • 13
  • 4
  • Possible duplicate of [.net WP8.1/Win10 UWP: Namespace for MapControl not found in Visual Studio Designer](http://stackoverflow.com/questions/31534197/net-wp8-1-win10-uwp-namespace-for-mapcontrol-not-found-in-visual-studio-design) – Shahriar Oct 16 '15 at 08:56
  • 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 Oct 17 '15 at 13:49
  • please show more information about `Terrain` – Shahriar Oct 17 '15 at 14:49
  • "Terrain" is a one of the values from the mapstyles Enum. – Chuckle Oct 17 '15 at 18:23
  • 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 Oct 19 '15 at 09:55

1 Answers1

0

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>
Tseng
  • 61,549
  • 15
  • 193
  • 205