O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting the Viewable Area of the Map

An alternative way of setting the viewable area of the map is to use the Map control’s SetView method. SetView accepts a LocationRectangle object, which specifies a rectangular region of the map.

The MapViewModel contains a LocationRectangle property that is applied to the map within the viewmodel’s PropertyChanged event handler, as shown in the following excerpt:

public MapView(){    var viewModel = new MapViewModel(new RouteCalculator());    viewModel.PropertyChanged += (sender, args) =>        {            switch (args.PropertyName)            {                ...                case "LocationRectangle":                    LocationRectangle rectangle = ViewModel.LocationRectangle; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required