Rehosting WWF designerp drag activity from toolbox to designer

Source: Internet
Author: User
To drag an activity from the toolbox to the designer, you must implement the interface in the Custom toolbox. Itoolboxservice . It is difficult to implement this relatively large interface by yourself. Toolboxservice Class. This class provides Itoolboxservice The default Implementation of the interface. There are many examples on the Internet.

Next we can useCodeTo add the toolbox to the Service in the designer.

Mysurface. addservice (Typeof(Itoolboxservice), Mytoolbox );

WhereMysurfaceIt refers to a surface designer or a surface manager instance,MytoolboxThis is an instance of the custom toolbox.

after completing these steps, the designer can use the drag-and-drop function to accept controls from the toolbox. I tried, form designer and usercontrol designer can be dragged and dropped. However, the workflow designer still cannot. For this reason, I have read the relevant information and found an article about " Windows Workflow Foundation-msdn forums > designer and the Toolbox " Article ( http://forums.microsoft.com/MSDN/ShowPost.aspx? Postid = 95682 & siteid = 1 ). The description is as follows:

In drag/drop operations, the workflow designer expectsDataobject[13] filled with two Custom Data blobs"Cf_winoedesignercomponents"And"Cf_winoedesignercomponentsstate". The code to fill in these values is quite long and Arjun was able to send me those lines though the rest of the sample isn't ready yet.Cf_winoedesignercomponentsIs a memory stream filled in with the entire activity graph serialized into binary using xomlcomponentserializationservice.Cf_winoedesignercomponentsstateIs also a memory stream, which contains the state for each designer of each activity in the graph.

And the following content is added:

Hopefully we will see the Microsoft sample soon, but I sincerely hope your of these steps are simplified into a helper component that can be released soon and added in the next beta cycle.

Hope is lost!

Later I found the following article"Windows Workflow Foundation: Everything about re-hosting the workflow designer"(Http://msdn.microsoft.com/library/default.asp? Url =/library/en-US/dnlong/html/wfdsgnrehst. asp).Cf_winoedesignercomponentsImplementation (in the serialization method and deserialization method respectively ). Even so, these two methods are not called at runtime, but this example can really implement drag-and-drop activities, which makes me confused.

So what is the key to affecting drag and drop? I carefully studied the exampleMousedownEvent, except for one line of statements,

ToolboxitemToolboxitem =Toolboxservice. Gettoolboxitem (selecteditem. componentclass );CorrectToolboxservice. GettoolboxitemMethods play a key role. Before callingItoolboxserviceOfSerializetoolboxitemThe parameters must beToolboxservice. GettoolboxitemInstead of using the following methodCurtoolitemAs a parameter.

TypeTyp =Typeof(Codeactivity);

_ Curtoolitem =New Toolboxitem(Typ );

Otherwise, the drag-and-drop operation will be ruined.

For more information about rehosting WWF designer, see my other articles:
Some technical details and Application Experience of WWF (1)
Some technical details and Application Experience of WWF (2)
Custom activity appearance during running of the rehosting WWF designer
Rehosting WWF designer-custom activity exterior
Rehosting WWF designerp drag activity from toolbox to designer
Rehosting WWF designer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.