locked
Dynamically Enabling/Disabling Add Menu of Compartment Shape in DSL RRS feed

  • Question

  • I have a compartment shape in my DSL and I want user to add Item into it based on the flag. User can right click on the shape and Add an Item by using Context Menu. Hence, I want to enable/disable this Context menu based on a flag that held as part of domain object. http://social.msdn.microsoft.com/Forums/en/dslvsarchx/thread/854b5fbd-7ca7-40eb-9558-e6abb1049d82  suggests to remove the Element merge directive corresponding to your child class in under the "Element Merge Directives" of your parent domain class in the "Domain Classes". But I need that context menu and want it enable and diable dynamically.
    Monday, January 3, 2011 1:52 PM

Answers

All replies

  • Hello

    I believe that the simplest is to use IMSLocks feature in order to prevent the items to be add-able. You'll find the documentation and the sample for the IMSLocks at http://code.msdn.microsoft.com/vsvmsdk/Release/ProjectReleases.aspx?ReleaseId=3850

    Best regards


    Jean-Marc
    Tuesday, January 4, 2011 8:29 AM
  • I have tried ImsLocks and I can see how you would do this at all. The locks seem to work on the whole object. I haven't figured out how to disable just the 'Add New XXX' on a container using the ImsLocks code. I have gone through the sample code and don't see that at all. The locking of the Add is at the store or partition level not on the container....
    Wednesday, June 19, 2013 3:27 PM
  • Check the 'Uses Custom Accept' on the Merge Directive for the parent object. From there you can return true or false as necessary. When false the 'Add New XXX' on the container will not be available when true it will be there. Tragically you will need to do one of these methods for every container on your Compartment shape that you want to control the 'Add New XXX' for.

    -Cam

    Wednesday, June 19, 2013 3:54 PM