Refer to mapStyle from another xaml

May 11, 2010 at 8:11 AM

 Hi all,

I'm trying to change the mapstyle via a button like this:


void changeMapStyleHy(object sender, EventArgs e)
SurfaceMap.MapStyle = InfoStrat.VE.VEMapStyle.Hybrid;


The problem is that the button is in another xaml than the actual SurfaceVEMap (x:Name=SurfaceMap).

The build error I get is: "The name 'Surfacemap' does not exist in the currrent context."

So how can I refer to SurfaceMap in the other xaml instead of the current xaml?

Thanks in advance





May 25, 2010 at 6:04 PM

If you have different classes, then you'll need to provide a way for one class to have a reference to the other class. Then you can say "otherclass.SurfaceMap.MapStyle = VEMapStyle.Hybrid;"