The MindFusion Forums
Flow Diagramming Components >> WPF >> SelectionModified event
https://mindfusion.eu/Forum/YaBB.pl?num=1489672073

Message started by milosa on Mar 16th, 2017 at 1:47pm

Title: SelectionModified event
Post by milosa on Mar 16th, 2017 at 1:47pm
Hello,

I have an issue with the events for the selection of the elements on the diagram.
So I want to be able to start an action when the user starts moving the selection of elements (nodes+links) for which SelectionStartModifying event is a good pick. Also I want to be able to react when the modifications to all the elements are done and I would expect that SelectionModified event is fired when all the changes to the events are done.

However the SelectionModified event is fired when we drop the elements (if we talk about dragging and dropping (moving)) but before the actual modifications to the positions of elements are done. Practically it means that you first have a SelectionModified event fired and then NodeModified event for every node that was in the selection (and the same for links).

Is this the desired functionality, because I would expect that SelectionModified is fired after all the NodeModified events?

If this is the desired functionality, do you see a way how I can react when all the changes are applied to all elements in the selection?

Regards!

Title: Re: SelectionModified event
Post by Slavcho on Mar 16th, 2017 at 4:40pm
Hi!


Quote:
but before the actual modifications to the positions of elements are done


What are you judging that from? The Bounds property of nodes should already have its final value at the time SelectionModified is raised, so if you inspect it from the selection event handler it should be correct. The order in which interaction is processed internally looks like this -

Selection.CompleteModify method called
  (for each) node.CompleteModify method called
SelectionModified event raised
  (for each) NodeModified event raised

Regards,
Slavcho

Title: Re: SelectionModified event
Post by milosa on Mar 17th, 2017 at 9:52am
Hello Slavcho,

I now double checked and it's true that the Bounds are changed for the nodes, however I would expect that the NodeModified events are raised when the bounds change, before the SelectionModified event is raised.

I am handling the change in the bounds of a node (updating my model and so on) in the handler for NodeModified. What I would expect is that when the selection of nodes is moved the same handlers are called to handle change in the bounds of each node and then the SelectionModified is raised so that I can do some final things that are specific for the selection.

Title: Re: SelectionModified event
Post by Slavcho on Mar 17th, 2017 at 10:36am
Hi,

So you want SelectionModified raised as some kind of marker indicating you won't get more NodeModified events? We guess that won't hurt anyone, this build reverses their order and will raise selection event last -
https://mindfusion.eu/_beta/wpfdiag_selmod.zip

Now if somebody complains they need SelectionModified raised first, I guess we'll need to add separate pre- and post- events.

Regards,
Slavcho

The MindFusion Forums » Powered by YaBB 2.6.11!
YaBB Forum Software © 2000-2024. All Rights Reserved.