I am trying to re-create the WF4 Workflow Designer. On the Import tab, I would like to import the default namespace imported. It looks like this:
Imported Namespaces http://imageshack.us/m/850/5383/imports.png
After many studies, I realized that if you look at
workflowDesigner.Context.Items.GetValue<ImportedNamespaceContextItem>().ImportedNamespaces
You will see that already imported. However, adding a namespace to this collection does not seem to have any effect. So my question is: how do I add imported namespaces to this list correctly? Or, how do I get the context for the update using the manually imported namespace import?
Additional information for the solution below :
To solve this problem, I created my desired “clean slide” activity XAML file, added it to my project, set its “Build” action to “Built-in resource” and its “Custom tool” to delete a line.
Then in the code that initializes my WorkflowDesigner, I do the following:
_Wd = new WorkflowDesigner();
_Wd.Load(
XamlServices.Load(
ActivityXamlServices.CreateBuilderReader(
new XamlXmlReader(
Assembly.GetEntryAssembly().GetManifestResourceStream( "WpfApplication1.New.xaml" )
)
)
) as ActivityBuilder
);
Now my workflow has all the desired imported namespaces.
source
share