.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Freeform Custom Activity Designers using ICompositeView

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :Windows Application
Hello,   I'm using code posted here http://blogs.msdn.com/b/tilovell/archive/2009/12/31/freeform-custom-activity-designers-using-icompositeview.aspx hosted in a designer taken from Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4( UsingWorkflowItemPresenter.sln). However, I can't drag & drop Activity1 given as sample into Canvas or any other kind of activity for that matter. Could you tell me what I'm doing wrong, please? Also, I would like to know how I could make the Canvas activity fill the WorkflowDesigner and not being able to be deleted. Thank you

View Complete Post

More Related Resource Links

The Perfect Host: Create And Host Custom Designers With The .NET Framework 2.0


The .NET Framework 2.0 introduces a set of classes that can be used to host designers right out of the box. With the understanding of designers you'll glean from this article, you'll be ready to host them in your own apps.

Dinesh Chandnani

MSDN Magazine March 2006

Creating a Validator class for a custom activity

I created a new Workflow Activity Library and then added a new Activity called BindForm2Activity. After that I added a new class called BindForm2Validator and then placed an attribute to the BindForm2Activity to link it to the validator class.   Here is the code for each of the classes:   BindForm2Activity.xoml.cs: Code Snippet   using System;using System.ComponentModel;using System.ComponentModel.Design;using System.Collections;using System.Drawing;using System.Linq;using System.Workflow.ComponentModel.Compiler;using System.Workflow.ComponentModel.Serialization;using System.Workflow.ComponentModel;using System.Workflow.ComponentModel.Design;using System.Workflow.Runtime;using System.Workflow.Activities;using System.Workflow.Activities.Rules; using FormsCollection;using Utils; namespace ActivityLibrary{    [ActivityValidator(typeof(BindForm2Validator))] public partial class BindForm2Activity : SequenceActivity {        public static DependencyProperty FormToBindProperty = System.Workflow.ComponentModel.DependencyProperty.Register("FormToBind", typeof(FormsCollection.Form2), typeof(BindForm2Activity));         [Description("Form to bind a datasource to it ")]        [Category("BindForm2ToDataSource")]        [Browsable(true)]        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]        public FormsCollection.Form2 Form

How to Prevent the expand/collapse behaviour of my Custom Activity?

  How can I prevent the expand feature of my custom activity with custom designer ? I have custom WF4 activities with Custom designers. These activities are not container activities. I just want to prevent the expand feature of the same; just like Assign activity. I set the Collapsible attribute of teh ActivityDesigner false; but still it is expanding to the next level. Thanks AmbilyIT Analyst

How to display breakpoint and debug visual cues with custom activity designer based on WorkflowViewE

Hi,   I am developing custom activity designers based on "WorkflowViewElement" instead of "ActivityDesigner" in my xaml. It allows me to have greater control of the look and feel of the designer. However I noticed that with this approach, the breakpoint visual cue (Dark red solid circle that appears on the left side of the designer when you set breakpoint on the designer) is not visible. It works fine when you write your designed based on "ActivityDesigner". The same behavior happens to the debug visual cue when you debugging the WF. It appears as bright yellow rectangle surrounding the activity designer if you are based on "ActivityDesigner", but it is not available when your designer is based on"WorkflowViewElement". Any help is highly appreciated. Li

Custom sequence activity deriving from System.Workflow.Activities.SequenceActivity

Hi, I try to create custom sequence activity. I found some sample (http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/f54e8eb2-29d9-46f6-ad96-766fe6fad333/). But this custom activity looks ugly (to separate nested activity using ellipses instead of arrows). My question is - how to create custom sequence activity, which will look like sequence activity. I also found this sample - <ContentPresenter x:Uid="ContentPresenter_1" Content="{Binding}" Style="{x:Static sacdt:DesignerStylesDictionary.SequenceStyle}"/> When I used this ContentPresenter my custom activity looks like System.Workflow.Activities.SequenceActivity, but I couldn't put on it another activity. I also created class, which derives from System.Workflow.Activities.SequenceActivity, but I couldn't see it in toolbox. My question is - how to create class, which derives from System.Workflow.Activities.SequenceActivity and is visible in toolbox or how to use ContentPresenter for sequence activity, which allows put on itself another activity.

Custom designer for a Flowchart activity?

Can anyone point me in the right direction for developing a custom designer for a Flowchart activity?  In actual fact, the Flowchart control we are using is a custom activity - it's not the regular .NET Flowchart activity, but our own creation with a collection for FlowNodes/etc.  We'd like to put a UI around it now as well ... mimicking the .NET Fllowchart designer.  Is that really possible, or extremely difficult?  It seems there's no real API or anything available for constructing the node connectors, arrows, etc.

CacheMetadata is not called when a custom activity is placed inside a flowchart

I wrote a simple Native activity which implements CacheMetadata(NativeActivityMetadata metadata) to declare arguments and variables. The activity works great but when I tried to use it inside a flowchart activity I found out that CacheMetadata is not called by visual studioo when the activity is dragged from the toolbox into the flow chart . This of course prevents my activity from working correctly. How can a custom activity be used inside a flowchart activity if CacheMetadata not called? Is there a way to make CacheMetadata run when the custom activity is placed inside a flowchart activity? Thanks Manu    

Custom Workflow Activity dependency property FieldNames

I have a custom actvity in VS2008. All is well until I added a new dependancy property like so: public static DependencyProperty EventLookupColumnNameProperty = DependencyProperty.Register("EventLookupColumnName",typeof(string),typeof(FTFSyncEventToAttachmentListItem)); public static DependencyProperty EventLookupColumnIDProperty = DependencyProperty.Register("EventLookupColumnID",typeof(string),typeof(FTFSyncEventToAttachmentListItem)); [Description("Event Lookup Column Name")][DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)][Browsable(true)][ValidationOption(ValidationOption.Required)]public string EventLookupColumnName{get { return ((string)(base.GetValue(EventLookupColumnNameProperty))); }set { base.SetValue(EventLookupColumnNameProperty, value); } [Description("Event Lookup Column ID")][ValidationOption(ValidationOption.Required)][Browsable(true)][DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]public int EventLookupColumnID{get { return ((int)(base.GetValue(EventLookupColumnIDProperty))); }set { base.SetValue(EventLookupColumnIDProperty, value); }}Then in the actions file:    <Action Name="FTF Sync Event To Attachment List Item"   ClassName="DP.Sharepoint.Workflow.FTFSyncEventToAttachmentListItem"   Assembly="DP.Sharepoint.Workflow, Version=, Cultur

Custom Activity properties usage

I have one Custom Activity which I have used in a dynamic workflow. Dynamic means I have re hosted the designer in windows form application. Now if I try to access this Custom Activity in any other Activities I got following message. "The type of the member "messageActivity1" could not be determined.  Ensure that the declaration is correct" The Dll of this activity is in GAC and in Win Form Bin. If do the same in .Net designer it works fine. Any idea to solve this???  farukh

Custom activity feed.

I am trying to implement activity feed functionality for SharePoint sites. User should be able to follow activities (document added, delete etc.) on multiple SharePoint sites by subscribing to it. All sites are available for all authenticated users. Users have the option of unsubscribing to it at any time. I know that I can add custom activities. The question that I have is how can I publish these events to only users who have subscribed to the site. There are about 50K users. Does SharePoint 2010 provide any mechanism for storing who has subscribed to what site and use that to publish the events?

Flowchart workflow, custom "FlowDecision" activity?

Dear all, in order to simplify the workflow "design" we would like to build our own activities that return a result with one or more nodes. Something like the "True/False" nodes that come out of the FlowDecision Activity. I know that one could normally add a FlowDecision activity after our custom activity and insert the condition expression to redirect the flow based on the result... however this requires the ability to know the "content" of the previous activity, and for some users we're targeting it's not immediate. Thank you!Adriano

How can i access to params and args defined in parent activity from custom NativeActivity


There is a scenario that the custom NativeActivity need to access to params or args defined in parent activity. What i have done as below

 protected override void Execute(NativeActivityContext context)


   WorkflowInstanceProxy proxy = context.GetExtension<WorkflowInstanceInfo>().GetProxy();

   Activity root = proxy.WorkflowDefinition;

   Activity rootChild = WorkflowInspectionServices.GetActivities(root).ElementAt(0);

   EditingContext ec = new EditingContext();

   ModelTreeManager mtm = new ModelTreeManager(ec);


   ModelItem modelItem = mtm.Root;

   ModelProperty c1 = modelItem.Properties["Variables"];

   ModelItemCollection c2 = c1.Collection;

   dynamic c3 = c2[0].GetCurrentValue();

   string value = c3.Get(context);


Apparently it is not possible to access to external params with local context so the error prompt "An activity can only access its own implementation variables."

My question is how to get it ? Is there another easy way to do so ?



be together be stro

Change custom activity behavior



To run the workflows from XAML I use WorkflowApplication.Run. I would like to change behavior of the custom activity depends on how the activity was running. I mean - in some situations my custom activity should report to DB, but in other situation shouldn't. I can add InArgument (or property) to this activity, but I don't know how to pass to my custom activity value for this InArgument (property).

Is there any other way to do, what I described?

My custom activity strategies/advices


Please see the  jpeg file Url here, this is my Custom activity and i have some
doubts/questions, i hope i make me understand:


1- where you have "Ponderadores": i wish that when the user drop this activity on the
workflow sequence, a list of my available variables (like size, price, capacity) appear
and the user select what variable he want to use. actually i do this using a comboBox.

2- where you see "Max.Limit": here the user insert a digit (long) and i do this using a
normal textBox.

3- on the blue border, i have here something similar with an if/else/then activity, but
without the else part :), but my problem here is the button because the user can insert
more then one conditions, can be 2, 3, 4, and so one... So my idea is to have a button
like you see. And whe the user click on that button a Two VB expressionTextBoxes are
created, under the first ones... One for condition and one for score. Do you have any
idea how to do this?

A great 2010 :) thanks in advance for the answer

WF4.0 Custom Activity - Property Editor or TypeConverter



As part of my custom activity development, I have a requirement to change the value of one property acording to another property's value.

For example, I have two properties- Position and Qualification in my custom activity. Once I select a position, the qualification should change according to the selected position value. Both, Position and Qualification  are string properties and the value of Position is populated with a TypeConverter. 

I tried with TypeConverter for Qualification property too. Issue is how to refresh the Qualification values on change of Position property?

I tried with PropertyEditor also. But not sure how to pass the data from my ActivityDesigner to PropertyEditor. I am handling the ModelItem.PropertyChanged event and getting the Qualification values. How to pass this values either to my TypeConverter or to My PropertyEditor?

PropertyEditor Code is as follows


If-then-else custom activity in c#

I am using WF 4.0 and i am trying to create a if-then-else custom activity in c#. Can I have a sample for that. I am able to find samples for 3.5 using workflow.activities.dll, but i dont want to do in 3.5. Please help.

"significant whitespace" build errors in workflows with custom designers (with attached sample proje

I'm using some custom designers in a workflow and occasionally get a combo of errors that don't make much sense.

On the designer surface, the following error is shown:

Cannot create unknown type '{clr-namespace:HurrDurr.Activities}MyActivity'.
System.Xaml.XamlObjectWriterException: Cannot create unknown type '{clr-namespace:HurrDurr.Activities}MyActivity'.
   at System.Xaml.XamlObjectWriter.WriteStartObject(XamlType xamlType)
   at blah blah yadda yadda...

In the error list, I get the following error:

Error 1 XC1020: Build error occurred in the XAML MSBuild task: 'The value ' ' contains significant white space(s) but "xml:space = preserve" cannot be written down on the member '{clr-namespace:HurrDurr.Activities;assembly=HurrDurr}MyActivity.Variables'.'

So the designer says the type is unknown, and the error list says I have some issue with significant whitespace.  Except I don't, or cannot find it.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend