Nevron Forum

Locking Down a LibraryView

https://www.nevron.com/Forum/Topic3484.aspx

By Jason Irby - Thursday, May 6, 2010

 

Hello,

 

I have created my own shape library and am loading it into a LibraryView control so the user can drag my predefined shapes on to a diagram.  However, I do not wish them to be able to:

1. Delete any of the shape masters currently on the libraryview

2. Drag and diagram shapes back onto the libraryview causing duplicates of the masters

 

I was looking for some kind of protection property to set but I could find none. 

Is there any way to lock dow nthe libraryview to prevent the user from modifying it but still be able to pull off it?

 

Thanks in advance,

Jason

By Nevron Support - Friday, May 7, 2010

Hi Jason,

To protect the library from masters deletion -> raise its RemoveElements protection. In fact for a completely locked down library you can protect it from RemoveElements, InsertElements and ReorderElements like this:

NAbilities protection = libraryDocument.Protection;
protection.RemoveElements = true;
protection.ReorderElements = true;
protection.InsertElements = true;
libraryDocument.Protection = protection;

Another way to prevent inserting elements with drag and drop is to set the AllowDrop property of the library view to false:

libraryView.AllowDrop = false;

When a certain action cannot be performed because of protection, the view will display a message. You can disable view messages like this:

libraryView.ShowMessages = false;