We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Raise an event before Delete

Hello,

I have a Diagram containing different Nodes. I would like to catch an event before any suppression of Nodes.

I tried, to override the ProcessKeyDown and ProcessKeyUp functions in a custom SelectTool (inheriting from SelectTool, and registered instead the original one), but the events seemed to be raised after suppression. Same result with the Windows EventHandler (OnKeyDown).

How can I have access to the Controller.SelectList before suppression ?

Thanks for your answer.

3 Replies

GM Gowri Manohari D Syncfusion Team September 10, 2009 09:41 AM UTC

Hi Stephane,

Thank you for choosing Syncfusion products.

Diagram does not have specific for NodeDelete. We can indirectly trigger some event before delete. For that we can EventSink_NodeCollectionChanging Event, it will fire adding or removing the nodes in diagram. We can achieve your requirement with the help of this method. Please refer the code snippet.

diagram1.Model.EventSink.NodeCollectionChanging+=new CollectionExEventHandler(EventSink_NodeCollectionChanging);
private void EventSink_NodeCollectionChanging(CollectionExEventArgs e)
{
if (e.ChangeType == CollectionExChangeType.Remove)
{
// your code
}
}

e.ChangeType indicates whether the node has been added or node has been deleted. Based on this changetype we can get the Controller.SelectionList before delete.

Let me know if you have any further questions in this regard.

Regards,
Gowri


SG Stephane Guerillot September 10, 2009 03:53 PM UTC

Thanks for your answer.

I didn't use the eventsink handler, but I've found the precog cyborg included in Syncfusion : he raises an event before I press a key on keyboard.

Thank you OnpreviewKeyDown ^^.


GM Gowri Manohari D Syncfusion Team September 11, 2009 06:09 AM UTC

Hi Stephane,

Thank you for your update.

Regards,
Gowri

Loader.
Live Chat Icon For mobile
Up arrow icon