<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: LocationDataSource.LocationChanged not firing in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213460#M11339</link>
    <description>&lt;P&gt;Trying to be clear what you are trying to do.&amp;nbsp; You are having the behavior trigger the command on every location changed if I am reading correctly.&lt;/P&gt;&lt;P&gt;I have taken a different approach and I inject the interface that exposes my LocationDataSource into the code behind and wire up there.&amp;nbsp; You are already injecting your&amp;nbsp;IGeoLocationService so not much different.&amp;nbsp; I do have some differing ideas on how I did things.&amp;nbsp; One thing is I use a control I made up to share my MapView among different Views in the application, but I think things will work the same either way.&amp;nbsp; You don't show&amp;nbsp;IGeoLocationService but have an idea what you are doing.&lt;/P&gt;&lt;P&gt;I've got&amp;nbsp;ILocationProvider which would seem to do the same as your&amp;nbsp;IGeoLocationService&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public interface ILocationProvider
{
	event EventHandler&amp;lt;ConnectionStatusChangedEventArgs&amp;gt; ConnectionStatusChanged;

	LocationDataSource LocationDataSource { get; }
	bool IsConnected { get; }
	bool ShowLocation { get; set; }
	string Receiver { get; }
}&lt;/LI-CODE&gt;&lt;P&gt;This implementation would then expose any type of LocationDataSource I want.&amp;nbsp; I have recently switched to using the NmeaLocationDataSource but all this worked with a custom LocationDataSource prior to&amp;nbsp;NmeaLocationDataSource being added to the API.&amp;nbsp; Below shows different implementations that I have and can swap out (SxBlueLocationProvider was the previous custom one used before NMEA was added to API)&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//containerRegistry.RegisterSingleton&amp;lt;ILocationProvider, SxBlueLocationProvider&amp;gt;();
containerRegistry.RegisterSingleton&amp;lt;ILocationProvider, SystemLocationProvider&amp;gt;();
//containerRegistry.RegisterSingleton&amp;lt;ILocationProvider, NmeaLocationProvider&amp;gt;();&lt;/LI-CODE&gt;&lt;P&gt;This part would be different because I am doing as a control, and so instead of injecting anything they are setup as BindableProperties&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public IEventAggregator EventAggregator
{
	get =&amp;gt; (IEventAggregator) GetValue(EventAggregatorProperty);
	set =&amp;gt; SetValue(EventAggregatorProperty, value);
}

public ILocationProvider LocationProvider
{
	get =&amp;gt; (ILocationProvider) GetValue(LocationProviderProperty);
	set =&amp;gt; SetValue(LocationProviderProperty, value);
}

public static readonly BindableProperty EventAggregatorProperty = ...

public static readonly BindableProperty LocationProviderProperty = ...&lt;/LI-CODE&gt;&lt;P&gt;You should be able to just inject into code behind like you do.&amp;nbsp; I think I have the relevant pieces included if you are setup with the MapView in a view&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private readonly ILocationProvider _provider;
private readonly IEventAggregator _eventAggregator;
		
public MainMapUC(ILocationProvider provider, IEventAggregator eventAggregator)
{
        _provide = provide;
        _eventAggregator = eventAggregator;
	InitializeComponent();
	
	mapView.PropertyChanged += (s, e) =&amp;gt;
	{
		//LocationDisplay is not set when MapView created
		if ( e.PropertyName == nameof(mapView.LocationDisplay) )
		{
			OnPropertyChanged(nameof(LocationProvider));
		}
	};
}


protected override void OnPropertyChanged(string propertyName = null)
{
	base.OnPropertyChanged(propertyName);

	switch (propertyName)
	{
		case nameof(LocationProvider):
			SetupLocationDataSource();
			break;
	}
}

private async void SetupLocationDataSource()
{
	try
	{
		MainThread.BeginInvokeOnMainThread(() =&amp;gt;
			mapView.LocationDisplay.DataSource = _provider.LocationDataSource);

		if ( mapView.LocationDisplay.DataSource?.Status == LocationDataSourceStatus.Stopped )
		{
			await mapView.LocationDisplay.DataSource?.StartAsync()!;
		}
	}
	catch (Exception e)
	{
		Log?.Error(e, e.Message);
		
	}
}&lt;/LI-CODE&gt;&lt;P&gt;In the code behind we are now tying the LocationDataSource to our map view.&amp;nbsp; At this point we should be using the custom LocationDataSource&lt;/P&gt;&lt;P&gt;Now you can setup listening for LocationChanged in any ViewModel you want.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public EditControlViewModel(IEventAggregator eventAggregator, ILocationProvider locationProvider, IFeatureAttributes featureAttributes) : base(eventAggregator)
{
	_locationProvider = locationProvider;
	_featureAttributes = featureAttributes;

	try
	{
		if ( _locationProvider.LocationDataSource != null )
		{
			if ( _locationProvider.LocationDataSource.Status == LocationDataSourceStatus.Started )
			{
				_locationProvider.LocationDataSource.LocationChanged += OnLocationChanged;
			}
			else
			{
				void OnLocationDataSourceStatusChanged(object s, LocationDataSourceStatus status)
				{
					if ( status == LocationDataSourceStatus.Started )
					{
						_locationProvider.LocationDataSource.LocationChanged += OnLocationChanged;

						//Remove Status Changed listener
						_locationProvider.LocationDataSource.StatusChanged -= OnLocationDataSourceStatusChanged;
					}
				}

				//If LocationDataSource has not yet started listen for Status Changed
				_locationProvider.LocationDataSource.StatusChanged += OnLocationDataSourceStatusChanged;
			}
		}
	}
	catch (Exception e)
	{
		Log?.Error(e, e.Message);
	}
}

private void OnLocationChanged(object sender, Esri.ArcGISRuntime.Location.Location location)
{
	_currentLocation = location;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I did a little extra stuff in there to make sure the LocationDataSource is up and running before tying the event to it.&amp;nbsp; Also my personal feelin is to try and avoid sending off Prism events from LocationChanged handler because that event is fired so frequently.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 16:14:59 GMT</pubDate>
    <dc:creator>JoeHershman</dc:creator>
    <dc:date>2022-09-16T16:14:59Z</dc:date>
    <item>
      <title>LocationDataSource.LocationChanged not firing</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213391#M11337</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have a WPF Prism app with a MapView which is getting a Map from the viewmodel.&amp;nbsp;&lt;/P&gt;&lt;P&gt;MainMapUC.xaml&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;    &amp;lt;esri:MapView        
        x:Name="MainMapView"            
        Map="{Binding Map}"&amp;gt;

        &amp;lt;ei:Interaction.Behaviors&amp;gt;            
            &amp;lt;bh:MapViewLocationDataChangedBehavior Command="{Binding UpdateLocationCommand}" /&amp;gt;
        &amp;lt;/ei:Interaction.Behaviors&amp;gt;

    &amp;lt;/esri:MapView&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a custom LocationDataSource by extending the `LocationDataSource` abstract class, exposed it via `IGeoLocationService` , and attached this location source to the MapView (later, I also used the `SimulatedLocationDataSource`).&lt;/P&gt;&lt;P&gt;MainMapUC.xaml.cs&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;		public MainMapUC(IGeoLocationService geoLocationService, IEventAggregator eventAggregator)
		{
			InitializeComponent();

			MainMapView.LocationDisplay.DataSource = geoLocationService.GetLocationDataSource();
			MainMapView.LocationDisplay.AutoPanMode = Esri.ArcGISRuntime.UI.LocationDisplayAutoPanMode.Recenter;	

			eventAggregator.GetEvent&amp;lt;GeoLocationEnabledEvent&amp;gt;().Subscribe(enable =&amp;gt; MainMapView.LocationDisplay.IsEnabled = enable);
		}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to get the Location object when it changes so I thought to hook up to the `LocationDataSource.LocationChanged` event but it's never fired.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found this solution that is exposing MapView properties via Behavior which is how I am hooking up to the event.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/marceloctorres/GeonetPost.WPF/blob/master/GeonetPost.WPF/" target="_blank"&gt;https://github.com/marceloctorres/GeonetPost.WPF/blob/master/GeonetPost.WPF/&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;	public class MapViewLocationDataChangedBehavior : Behavior&amp;lt;MapView&amp;gt;
	{        
        public static readonly DependencyProperty CommandProperty = 
                DependencyProperty.Register(
                    nameof(Command),
                    typeof(ICommand),
                    typeof(MapViewLocationDataChangedBehavior)
                );

        public ICommand Command
        {
            get { return (ICommand)GetValue(CommandProperty); }
            set { SetValue(CommandProperty, value); }
        }

        protected override void OnAttached()
        {
			this.AssociatedObject.LocationDisplay.DataSource.LocationChanged += DataSource_LocationChanged;
        }

		
		protected override void OnDetaching()
        {
			this.AssociatedObject.LocationDisplay.DataSource.LocationChanged -= DataSource_LocationChanged;
        }

		private void DataSource_LocationChanged(object sender, Esri.ArcGISRuntime.Location.Location e)
		{
            if (this.Command != null)
            {
                if (this.Command.CanExecute(e))
                {
                    this.Command.Execute(e);
                }
            }
        }
	}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MainMenuVM.cs&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;	internal class MainMapVM : BindableBase
	{
		private IEventAggregator _eventAggregator;
		public MainMapVM(IEventAggregator eventAggregator)
		{
			Map = new Map()
			{
				Basemap = new Basemap(BasemapStyle.ArcGISStreets),
				InitialViewpoint = new Viewpoint(59, 6, 1000000),
			};

			UpdateLocationCommand = new DelegateCommand&amp;lt;Location&amp;gt;(UpdateLocationAction, CanUpdateLocation);
			_eventAggregator = eventAggregator;			
		}

		private void UpdateLocationAction(Location newLocation)
		{
			_eventAggregator.GetEvent&amp;lt;GeoLocationChangedEvent&amp;gt;().Publish(newLocation);
		}
		private bool CanUpdateLocation(Location newLocation)
		{
			return true;
		}

		public ICommand UpdateLocationCommand { get; private set; }

		private Map _map;
		public Map Map
		{
			get { return _map; }
			set { SetProperty(ref _map, value); }
		}
	}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No matter what I do, I couldn't get the LocationDataSource events to fire.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:51:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213391#M11337</guid>
      <dc:creator>ViktorSafar</dc:creator>
      <dc:date>2022-09-16T13:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: LocationDataSource.LocationChanged not firing</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213401#M11338</link>
      <description>&lt;P&gt;My own implementation of LocationDataSource:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;	internal class MyLocationDataSource : LocationDataSource, ILocationSource
	{

		public LocationDataSource LocationDataSource =&amp;gt; this;

		public async Task GetLocation()
		{
			
			var result = ... // location obtained from a source

			var newLocation = new Location(
				new Esri.ArcGISRuntime.Geometry.MapPoint(result.longitude, result.latitude, SpatialReferences.Wgs84),
				50,
				0,
				0,
				false
			);

			base.UpdateLocation(newLocation);	// &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; I thought this would fire the LocationChanged event		
		}

		protected override async Task OnStartAsync()
		{
			await GetLocation();
		}

		protected override Task OnStopAsync()
		{
			return Task.CompletedTask;
		}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can see the dot on the MapView but the LocationChanged event is never fired.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And as mentioned, I also tried the SimulationLocationDataSource. With this, I can see the dot moving around the map, but the LocationChanged event is never fired&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;			var simulatedLocations = (Polyline)Geometry.FromJson("{\"paths\":[[[-13185646.046666779,4037971.5966668758],[-13185586.780000051,4037827.6633333955], [-13185514.813333312,4037709.1299999417],
...
[-13182618.624747934,4034679.7416197238]]], \"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}");
			var parameters = new SimulationParameters(DateTimeOffset.Now, 150);
			var simulatedSource = new SimulatedLocationDataSource();
			simulatedSource.SetLocationsWithPolyline(simulatedLocations, parameters);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 14:16:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213401#M11338</guid>
      <dc:creator>ViktorSafar</dc:creator>
      <dc:date>2022-09-16T14:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: LocationDataSource.LocationChanged not firing</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213460#M11339</link>
      <description>&lt;P&gt;Trying to be clear what you are trying to do.&amp;nbsp; You are having the behavior trigger the command on every location changed if I am reading correctly.&lt;/P&gt;&lt;P&gt;I have taken a different approach and I inject the interface that exposes my LocationDataSource into the code behind and wire up there.&amp;nbsp; You are already injecting your&amp;nbsp;IGeoLocationService so not much different.&amp;nbsp; I do have some differing ideas on how I did things.&amp;nbsp; One thing is I use a control I made up to share my MapView among different Views in the application, but I think things will work the same either way.&amp;nbsp; You don't show&amp;nbsp;IGeoLocationService but have an idea what you are doing.&lt;/P&gt;&lt;P&gt;I've got&amp;nbsp;ILocationProvider which would seem to do the same as your&amp;nbsp;IGeoLocationService&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public interface ILocationProvider
{
	event EventHandler&amp;lt;ConnectionStatusChangedEventArgs&amp;gt; ConnectionStatusChanged;

	LocationDataSource LocationDataSource { get; }
	bool IsConnected { get; }
	bool ShowLocation { get; set; }
	string Receiver { get; }
}&lt;/LI-CODE&gt;&lt;P&gt;This implementation would then expose any type of LocationDataSource I want.&amp;nbsp; I have recently switched to using the NmeaLocationDataSource but all this worked with a custom LocationDataSource prior to&amp;nbsp;NmeaLocationDataSource being added to the API.&amp;nbsp; Below shows different implementations that I have and can swap out (SxBlueLocationProvider was the previous custom one used before NMEA was added to API)&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//containerRegistry.RegisterSingleton&amp;lt;ILocationProvider, SxBlueLocationProvider&amp;gt;();
containerRegistry.RegisterSingleton&amp;lt;ILocationProvider, SystemLocationProvider&amp;gt;();
//containerRegistry.RegisterSingleton&amp;lt;ILocationProvider, NmeaLocationProvider&amp;gt;();&lt;/LI-CODE&gt;&lt;P&gt;This part would be different because I am doing as a control, and so instead of injecting anything they are setup as BindableProperties&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public IEventAggregator EventAggregator
{
	get =&amp;gt; (IEventAggregator) GetValue(EventAggregatorProperty);
	set =&amp;gt; SetValue(EventAggregatorProperty, value);
}

public ILocationProvider LocationProvider
{
	get =&amp;gt; (ILocationProvider) GetValue(LocationProviderProperty);
	set =&amp;gt; SetValue(LocationProviderProperty, value);
}

public static readonly BindableProperty EventAggregatorProperty = ...

public static readonly BindableProperty LocationProviderProperty = ...&lt;/LI-CODE&gt;&lt;P&gt;You should be able to just inject into code behind like you do.&amp;nbsp; I think I have the relevant pieces included if you are setup with the MapView in a view&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private readonly ILocationProvider _provider;
private readonly IEventAggregator _eventAggregator;
		
public MainMapUC(ILocationProvider provider, IEventAggregator eventAggregator)
{
        _provide = provide;
        _eventAggregator = eventAggregator;
	InitializeComponent();
	
	mapView.PropertyChanged += (s, e) =&amp;gt;
	{
		//LocationDisplay is not set when MapView created
		if ( e.PropertyName == nameof(mapView.LocationDisplay) )
		{
			OnPropertyChanged(nameof(LocationProvider));
		}
	};
}


protected override void OnPropertyChanged(string propertyName = null)
{
	base.OnPropertyChanged(propertyName);

	switch (propertyName)
	{
		case nameof(LocationProvider):
			SetupLocationDataSource();
			break;
	}
}

private async void SetupLocationDataSource()
{
	try
	{
		MainThread.BeginInvokeOnMainThread(() =&amp;gt;
			mapView.LocationDisplay.DataSource = _provider.LocationDataSource);

		if ( mapView.LocationDisplay.DataSource?.Status == LocationDataSourceStatus.Stopped )
		{
			await mapView.LocationDisplay.DataSource?.StartAsync()!;
		}
	}
	catch (Exception e)
	{
		Log?.Error(e, e.Message);
		
	}
}&lt;/LI-CODE&gt;&lt;P&gt;In the code behind we are now tying the LocationDataSource to our map view.&amp;nbsp; At this point we should be using the custom LocationDataSource&lt;/P&gt;&lt;P&gt;Now you can setup listening for LocationChanged in any ViewModel you want.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public EditControlViewModel(IEventAggregator eventAggregator, ILocationProvider locationProvider, IFeatureAttributes featureAttributes) : base(eventAggregator)
{
	_locationProvider = locationProvider;
	_featureAttributes = featureAttributes;

	try
	{
		if ( _locationProvider.LocationDataSource != null )
		{
			if ( _locationProvider.LocationDataSource.Status == LocationDataSourceStatus.Started )
			{
				_locationProvider.LocationDataSource.LocationChanged += OnLocationChanged;
			}
			else
			{
				void OnLocationDataSourceStatusChanged(object s, LocationDataSourceStatus status)
				{
					if ( status == LocationDataSourceStatus.Started )
					{
						_locationProvider.LocationDataSource.LocationChanged += OnLocationChanged;

						//Remove Status Changed listener
						_locationProvider.LocationDataSource.StatusChanged -= OnLocationDataSourceStatusChanged;
					}
				}

				//If LocationDataSource has not yet started listen for Status Changed
				_locationProvider.LocationDataSource.StatusChanged += OnLocationDataSourceStatusChanged;
			}
		}
	}
	catch (Exception e)
	{
		Log?.Error(e, e.Message);
	}
}

private void OnLocationChanged(object sender, Esri.ArcGISRuntime.Location.Location location)
{
	_currentLocation = location;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I did a little extra stuff in there to make sure the LocationDataSource is up and running before tying the event to it.&amp;nbsp; Also my personal feelin is to try and avoid sending off Prism events from LocationChanged handler because that event is fired so frequently.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 16:14:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213460#M11339</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2022-09-16T16:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: LocationDataSource.LocationChanged not firing</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213519#M11340</link>
      <description>&lt;P&gt;Ah, beautiful. I totally overcomplicated it.&lt;/P&gt;&lt;P&gt;I simplified to IGeoLocationService to&amp;nbsp;ILocationProvider (registers as singleton):&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;	public interface ILocationProvider
	{
		public LocationDataSource LocationDataSource { get; }
	}&lt;/LI-CODE&gt;&lt;P&gt;and removed all of the Behavior/Command stuff&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;	public partial class MainMapUC : UserControl
	{
		public MainMapUC(ILocationProvider locationProvider, IEventAggregator eventAggregator)
		{
			InitializeComponent();

			MainMapView.LocationDisplay.DataSource = locationProvider.LocationDataSource;
			MainMapView.LocationDisplay.AutoPanMode = Esri.ArcGISRuntime.UI.LocationDisplayAutoPanMode.Recenter;	

			eventAggregator.GetEvent&amp;lt;GeoLocationEnabledEvent&amp;gt;().Subscribe(enable =&amp;gt; MainMapView.LocationDisplay.IsEnabled = enable);			
		}
	}&lt;/LI-CODE&gt;&lt;LI-CODE lang="csharp"&gt;	internal class MainMapVM : BindableBase
	{
		private readonly IEventAggregator _eventAggregator;
		private readonly ILocationProvider _locationProvider;

		public MainMapVM(IEventAggregator eventAggregator, ILocationProvider locationProvider)
		{
			_eventAggregator = eventAggregator;
			_locationProvider = locationProvider;

			Map = new Map()
			{
				Basemap = new Basemap(BasemapStyle.ArcGISStreets),
				InitialViewpoint = new Viewpoint(0, 0, 1000000),
			};
			
			_locationProvider.LocationDataSource.LocationChanged += (sender, e) =&amp;gt; _eventAggregator.GetEvent&amp;lt;GeoLocationChangedEvent&amp;gt;().Publish(e);
		}

		private Map _map;
		public Map Map
		{
			get { return _map; }
			set { SetProperty(ref _map, value); }
		}
	}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and all is working perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for setting me on the right path!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 18:09:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213519#M11340</guid>
      <dc:creator>ViktorSafar</dc:creator>
      <dc:date>2022-09-16T18:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: LocationDataSource.LocationChanged not firing</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213601#M11341</link>
      <description>&lt;P&gt;My guess would be that when you set up the `event&amp;nbsp;this.AssociatedObject.LocationDisplay.DataSource.LocationChanged` you're doing it to the datasource, before you're reassigning the datasource, but your code never checks is the datasource changes, where you'd then unsubscribe from the old one and subscribe to the new one. At least double check that this event handler is hooked up _after_ you assign the new datasource.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 21:42:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213601#M11341</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2022-09-16T21:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: LocationDataSource.LocationChanged not firing</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213603#M11342</link>
      <description>&lt;P&gt;Regarding this:&lt;/P&gt;&lt;PRE&gt;protected override async Task OnStartAsync()
{
    await GetLocation();
}&lt;/PRE&gt;&lt;P&gt;This method shouldn't get the location. It should start monitoring for locations (ie start listening to an event source, or launch a thread that starts monitoring in a loop), and when locations gets updated, you call base.UpdateLocation. Stop async would then stop that thread (or unsubscribe depending on what you're getting locations from)&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 21:45:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1213603#M11342</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2022-09-16T21:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: LocationDataSource.LocationChanged not firing</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1217293#M11370</link>
      <description>&lt;P&gt;Thanks, Morten. I agree this is not the best show of how it should work. In this case the location is ever obtained just a single time as it was IP based - so I thought it was OK to trigger it from OnStartAsync().&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 09:59:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/locationdatasource-locationchanged-not-firing/m-p/1217293#M11370</guid>
      <dc:creator>ViktorSafar</dc:creator>
      <dc:date>2022-09-29T09:59:47Z</dc:date>
    </item>
  </channel>
</rss>

