Jerome Dreyer
Jerome Dreyer

Reputation: 144

UWP MapControl: distinction between user- and app-manipulation

Within an UWP-App containing a MapControl, is there a way to distinct between a manipulation to the map made by the user (e.g. by pinch to zoom) and one, that is made by the app itself? (e.g. by calling mapControl.TrySetViewAsync(...))

It doesn't seem like that there's an eventhandler for that, right? I already tried several ones (like LoadingStatusChanged or CenterChanged), but none of them are making any difference between user- and app-manipulation..

Upvotes: 1

Views: 165

Answers (1)

S. Matthews
S. Matthews

Reputation: 355

You should be able to register to receive a TargetCameraChanged event that will fire whenever the map view changes. The MapTargetCameraChangedEventArgs returned contain a ChangeReason property.

The ChangeReason property will be System, UserInteraction or Programmatic.

Map movements caused by calling APIs such as TrySetViewAsync(...) cause events that have ChangeReason == Programmatic, and movements caused by user actions such as pinch to zoom should have ChangeReason == UserInteraction.

Upvotes: 4

Related Questions