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; ...

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.