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

Disable the nodes in a Layer.

I want add rectangles in a layer and circles in a different layer. If I call Layer.Visible = false, all the nodes added to the corresponding layer is hidden. But when I call Layer.Enabled = False I could still work on nodes on that layer? How do I make all nodes in a layer "Read Only"? I should also be able to go to a mode in which I can do modifications.



2 Replies

JP John Previn Kumar August 5, 2011 08:32 AM UTC

Should I loop thru all nodes in the layer and make Enabled as false? or is there a way to make entire Layer disabled?



AA Amsath Ali M Syncfusion Team August 5, 2011 08:40 AM UTC

Hi JVM,

Thanks for your interest in Syncfusion products.

The Layer.Enabled property is used to indicate whether the layer should be active or not, where by default it is set to ‘False’. We suggest you to loop through all nodes in a layer and use the Node’s ‘Editstyle's’ properties to make nodes in a layer as ‘Readonly’. Please refer the below code snippet to achieve your requirement.
[C#]
foreach (Node node in layer.Nodes)
{
node.EditStyle.AllowChangeHeight = false;
node.EditStyle.AllowChangeWidth = false;
node.EditStyle.AllowRotate = false;
node.EditStyle.AllowMoveX = false;
node.EditStyle.AllowMoveY = false;
}

For more information about Layers, please visit the below online UG link:
http://help.syncfusion.com/ug_92/User%20Interface/Windows%20Forms/Diagram/Documents/444layers.htm

For your convenience, we have created a simple sample to achieve your requirement.
Please try the below sample and let us know if you have any queries.
Layer test1125834057.zip

Regards,
Amsath Ali. M




Loader.
Live Chat Icon For mobile
Up arrow icon