Select to view content in your preferred language

How to determine when a GraphicElement in a GraphicLayer gets edited, resized, moved, etc.

231
4
Jump to solution
a month ago
Gurunara
Occasional Contributor

How to determine when a GraphicElement in a GraphicLayer gets edited, resized, moved, etc.

Also how to determine when a new GraphicElement is added or existing ones are deleted?

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

There is ElementEvent. Event argument member Hint has some different states for changes: ElementAdded , ElementRemoved, PlacementChanged.

View solution in original post

0 Kudos
4 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

There is ElementEvent. Event argument member Hint has some different states for changes: ElementAdded , ElementRemoved, PlacementChanged.

0 Kudos
Gurunara
Occasional Contributor

There is some issue with using ElementEvent.Subscribe(args =>

{

if (args.Hint == ElementEventHint.PlacementChanged)

});

This event gets triggered hundreds of times on a single move of a graphic element (not during but at the end of the move).
Is this a bug... and any way to prevent this so only one event is handled at the end of a move..?

0 Kudos
Gurunara
Occasional Contributor

Looks like there are properties for various attributes that could change, and have to check to see if any one of them have changed, each of which is generating an ElementEventHint.PlacementChanged event...

but they seem to be private properties, i.e. for each element in ElementEventArgs args.Elements, examine _placement... so may have to do it using reflection...

for now just by placing a delay of 2 sec after handling for the first placment event before allowing next one to be handled... seem a good enough workaround...

0 Kudos