ViewpointChanged event raised multiple time

731
2
Jump to solution
05-17-2020 08:34 PM
PrashantKirpan
Occasional Contributor

Hi All,

I've subscribed ViewpointChanged event and running some code whenever map extent changes or zoom in/out.

I observed that whenever I interact with map e.g. zoom in/out event get fired multiple times(3-4) and along with that code executes and slow down the performance.

How can I prevent event execution multiple times or just capture the last instance?

Version: WPF 100.8

Any help would be appreciated.

Regards,

Prashant

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

As you're zooming or panning, the viewpoint is changing and therefore the event is firing. You don't want to run a bunch of heavy operations in that event.

If you need to run some more expensive code, I'd recommend you use the NavigationCompleted event, which is more meant for that sort of thing.

View solution in original post

2 Replies
dotMorten_esri
Esri Notable Contributor

As you're zooming or panning, the viewpoint is changing and therefore the event is firing. You don't want to run a bunch of heavy operations in that event.

If you need to run some more expensive code, I'd recommend you use the NavigationCompleted event, which is more meant for that sort of thing.

PrashantKirpan
Occasional Contributor

Thanks Morten for reply. It's working !!!

0 Kudos