![]() NContextMenu contextMenu = new NContextMenu() Ĭ(CreateCommand((int)DiagramCommand.Delete, false)) Īfter that create an instance of this custom context menu builder and assign it to the ContextMenuBuilder property of your diagram command bars manager: Public override NContextMenu BuildContextMenu(object obj) Internal class CustomContextMenuBuilder : NDiagramContextMenuBuilder There you need to create the context menu and add the required commands to the created context menu. This will create/add the required command that you want to provide to the user while working in the diagram.įirst create a Custom ContextMenuBuilder by inheriting “NDiagramContextMenuBuilder” class and override “BuildContextMenu” method. Real Solution The simplest solution is that create a custom context menu builder for creating context menu for the current diagram view. NAbilities shapeAbilities = new NAbilities() ![]() These can be set programmatically, these are just for making restrictions on the shape not for the context menu operations. ![]() You can restrict few operation on the shape for the user. See the below image, If the edited port name is used in program to identity the center port then it will be distinguish the center port in all of these ports.įinally, it is required to remove some commands from the context menu of the shape in the diagram view for the user so that user will not able to modify the shape elements.Īt first place, you need to use the “Protection” on the shape to prevent some operation. If shape elements are used to identify the shape elements by name then it will break the program for being consistent for these shapes. If user change these shapes then it will be hard to know that it has been modified this diagram is saved as XML string in some data store. This restriction is required during the development for most of the cases because programs are using these shapes for some special purpose representation and these should not be altered by the use at run time to keep them consistent. I had a requirement for preventing user to edit the “Composite Shape” elements (e.g.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |