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
close icon

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

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

6 Replies

AD Administrator Syncfusion Team 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


AD Administrator Syncfusion Team September 20, 2005 02:42 PM UTC

It works now :)


AD Administrator Syncfusion Team 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.,


AD Administrator Syncfusion Team September 27, 2005 05:52 PM UTC

Prakash, The layer collection (v. 3.3.0.0 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


AD Administrator Syncfusion Team 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 3.3.0.0 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.,


AD Administrator Syncfusion Team 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.

Loader.
Live Chat Icon For mobile
Up arrow icon