Custom drop target

The automatically generated designer in DSL assumes that you have to put the shape on the surface and then eventually connect to others.

Statements, in microbasic, are executed sequentially so I want the designer to attach my shapes to one previously placed, dropping it in the link between two shapes.

To drive the shapes drop behaviour I have to modify where the shapes are allowed to be dropped.

Setting the attribute UsesCustomAccept does this (or at least I hope!!!).

<?xml version="1.0" encoding="utf-8"?>
<Dsl dslVersion="" Id="bd36672a-93b9-4dce-82f8-2551432eb244" Description="Description for myns.Language1.Language1" ...>
    <DomainClass Id="3a3a6bfd-90ef-4418-91a7-3792d2201167" Description="The root in which all other elements are embedded. Appears as a diagram." ....>
        <ElementMergeDirective UsesCustomAccept="true">
          <Notes>Creates an embedding link when an element is dropped onto a model. </Notes>
            <DomainClassMoniker Name="ExampleElement" />

As usual regenerate the templates and recompile.

An error appears...

Error    1    'myns.Language1.ExampleModel' does not contain a definition for 'CanMergeExampleElement' and no extension method 'CanMergeExampleElement' accepting a first argument of type 'myns.Language1.ExampleModel' could be found

Clicking on the error you are taken to the  call to the method that you have to implement. Using vs is easy to do this..hover your mouse to the little rectangle at the beginning of the method name.



Copy the generated method stub to your partial class and implement it.

How? I don't know...Stay tuned...

posted @ venerdì 9 maggio 2008 23:59

Comments have been closed on this topic.