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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Determining when a node is added or removed from a layer.

Thread ID:





34966 Sep 20,2005 02:16 PM UTC Sep 30,2005 12:12 PM UTC WinForms 6
Tags: Diagram
Administrator [Syncfusion]
Asked On September 20, 2005 02:16 PM UTC

Hi Prakash, I have a good one for you if you get a chance to think about it: My requirements: 1. Display a list of nodes on each layer. No problem. I am able to do this, and I am using 2 layers; the default layer for all my objects, and a new one that I added for my ''special'' type of symbol. My custom model gives me access to these two layers 2. Update the lists when a nodes are added/removed in the diagram. My problem: Layers do not get the new node until after all possible ''new node'' events are fired. This means that out of all the ways I can detect that a node is added/removed, it always occurs before the node is updated on the respective layer, meaning the node lists will display the incorrect number of nodes. My possible solutions: 1. Listen for a collection changed event from the desired layers. 1.A. Requires subclassing the layers so I can provide the event. 1.B. Problem: I am unable to access the default layer to make it a custom Layer. 2. Override the AppendChild/AppendChildren (and remove) methods and put an event after calling the base method. 2.A. Problem: Not all of these methods are virtual. 3. Add a timer to the list views for them to update a few ms after nodes are changed in the Model. 3.A Problem: This is ugly and is a last resort. Things that would allow me to solve this problem easily. 1. Access to setting/getting the defaultlayer or 2. A collection changed event for layers. 3. Modifying Syncfusion source (I''d rather not) 4. Some creative workaround. If you have any thoughts or ideas, please let me know. Thanks, Kevin

Administrator [Syncfusion]
Replied On September 20, 2005 02:23 PM UTC

Well, about a minute after posting that I found my workaround. I just realized I can set the default layer via Model.DefaultLayerName. On a side note: As far as I know the only way to use custom Layers is to use Model.Layers.List.Add(object) since LayerCollection only has Add(string). Thanks, Kevin

Administrator [Syncfusion]
Replied On September 20, 2005 02:42 PM UTC

It works now :)

Administrator [Syncfusion]
Replied On September 26, 2005 03:51 PM UTC

Hi Kevin, The easiest way to add a custom layer is to directly create an instance of the Layer, and add it to the diagram.Model.Layers collection. The minor update of Essential Diagram that we are currently working on, and hope to make available within the week, will have a new sample showing a diagram with multiple layers. Thanks, Prakash Surendra Syncfusion Inc.,

Administrator [Syncfusion]
Replied On September 27, 2005 05:52 PM UTC

Prakash, The layer collection (v. RC, I still need to upgrade) only has the ability to add a new layer by providing a string, which as a result uses the standard Syncfusion Layer. I got around this by doing Model.Layers.List.Add(MyLayer); and I made sure I instantiated MyLayer using the proper constructor: new MyLayer(layerCollection, layerName); Thanks for the reply, Kevin

Administrator [Syncfusion]
Replied On September 29, 2005 06:31 PM UTC

Hi Kevin, My oversight...sorry about that. The LayerCollection.Add(Layer) and LayerCollection.Insert(int, Layer) methods were added after the release. We hope to have a private update of Essential Diagram within the next few days and this will include the revised code. Regards, Prakash Surendra Syncfusion Inc.,

Administrator [Syncfusion]
Replied On September 30, 2005 12:12 PM UTC

Nah, thats not an oversight. An oversight is when I spend a day trying to figure out a solution to a problem (how this thread got started) when the solution is staring me in the face.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon