tags:

views:

86

answers:

2

My xaml is as follows:

<m:Map CredentialsProvider="XXX" x:Name="mainMap"/>
<BingEditableMapControl:BingMapEditingControl BingMap="mainMap" />

For BingEditableMapControl, the property BingMap is a dependency property takes the control of Map. How do i pass the mainMap to the BingMap property through xaml?

A: 

Make mainMap a static resource and bind the BingMap property like this

BingMap={StaticResource mainMap}

Petar Kabashki
how do i turn it into a resource? And its the map that is displaying that i want to be passed to the BingMapEditingControl
Shawn Mclean
Add the following just under the <Window> tag<Window.Resources> <m:Map CredentialsProvider="XXX" x:Key="mainMap"/></Window.Resources>
Petar Kabashki
using a resource doesn't work because the map is not shown.
Shawn Mclean
Hmm, that suggestion was stupid in this case, sorry ... Have you tried wrapping mainMap inside BingMap as a nested element like this<BingEditableMapControl:BingMapEditingControl.BingMap> <m:Map CredentialsProvider="XXX" x:Name="mainMap"/></BingEditableMapControl:BingMapEditingControl.BingMap>
Petar Kabashki
+1  A: 

Try it like this:-

<m:Map CredentialsProvider="XXX" x:Name="mainMap"/>
<BingEditableMapControl:BingMapEditingControl BingMap="{Binding ElementName=mainMap}" />
AnthonyWJones