Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Deployment
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]Actions
  [Expand]Navigation
  [Expand]Views
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Templates
  [Expand]Filtering
  [Expand]Reporting
  [Expand]Dashboards
  [Expand]Scheduler and Notifications
  [Collapse]Maps
    How to: Change the Map Marker Icon
    How to: Change the Map Settings Dynamically
    How to: Customize the Vector Map Palette
    How to: Draw Lines on a Map using Google Maps API
    How to: Set the Latitude and Longitude of a Map Marker to the Current Location
    How to: Show a Current Location on a Map
    How to: Specify the Map Center Using Human-Readable Location Instead of Numeric Coordinates
  [Expand]Security
  [Expand]Workflow
  [Expand]Localization
  [Expand]Testing
  [Expand]Miscellaneous UI Customizations
 [Expand]Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
[Expand]End-User Documentation

How to: Show a Current Location on a Map

This topic describes how to access the dxMap widget directly using JavaScript code and show a current position on a map in a Mobile application.

  • Add the ShowCurrentLocationController View Controller to the Mobile module project.
  • In the constructor, set the ViewController.TargetViewId property, for example, to MapsMarker_ListView.
  • Override the OnViewControlsCreated method and access the MobileMapsListEditor List Editor and its Map control.
  • Specify the control's Map.OnCustomize property with the string which is the JavaScript client-side event to get a current position using the navigator.geolocation.getCurrentPosition() method and set this position as the map's center. Note that JavaScript code should be enclosed in brackets.

The result is demonstrated in the image below.

How would you rate this topic?​​​​​​​