Initialize View on App Load

Aug 29, 2008 at 6:53 PM

In an effort to set the view to an area of interest on the start of application, I've tried the following:

 

In public Page() :         Loaded +=

new RoutedEventHandler(Page_Loaded);
In Page_Loaded(...):    map.SetView(new Point { X = ......

I've also tried:

In public Page():        setInitialView();
In setInitialView():    map.SetView(new Point { X = .....

NEITHER OF THESE APPROACHES WORK, THE MAP VIEW IS SET TO WORLD.  CAN SOMEONE GIVE ME A CLUE ON THIS???  Thanks.

 

Developer
Aug 29, 2008 at 11:52 PM
this is a bit of code from the "Map.cs" in the "DeepEarth" project...
if you read the comment it seems as if that the map center point is set there... for loading..?

 

set

 

{

 

//TODO: Probably should cache the center to allow the

 

 

//user to set it before the map loads

 

 

IProjection projection = Projection;

 

 

if (projection != null && MultiScaleImage != null)

 

{

 

Point pixel = projection.ToDisplay(value, this, MapWidth);

 

pixel = TransformToVisual(MultiScaleImage).Transform(pixel);

ViewOffset = pixel;

}

Sep 19, 2008 at 3:30 PM
This has been resolved thanks to dotnetnoobie: see http://www.codeplex.com/deepearth/Thread/View.aspx?ThreadId=35877