简体   繁体   中英

Window workflow foundation 4.0 (WPF): How to change an activity location in a Flowchart workflow by code

I use rehosting workflow designer ( https://msdn.microsoft.com/en-us/library/dd489419%28v=vs.100%29.aspx ) to load a Flowchart workflow in my application.

 Flowchart flowchart = this.CreateFlowchart();///Create a Flowchart workflow
 WorkflowDesigner wd = new WorkflowDesigner();
 wd.Load(flowchart);

How should I do to change an activity location in the Flowchart?

This is certainly not a trivial task.

You effectively need to alter the location of the model item via the view state service.

wd.Context.Services.GetService<ViewStateService>().StoreViewStateWithUndo(modelItem, "ShapeLocation", new Point(20,20));

Have a read of this article which explains view state far better than I can.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM