.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

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

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :Windows Application
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    

View Complete Post

More Related Resource Links

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.

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

Custom UITypeEditor Is Ignored After Activity.Bind called :(


Hello Everyone,

I've created my own custom PropertyBindDialog because the one that Microsoft provides is pretty deficient.  Unfortunately my own custom PropertyBindDialog will not be used after I call Activity.SetBinding - after I do this for a given property my own custom PropertyBindDialog is ignored and the Microsoft BindDialog is used. 

Here's some of my source code...

The problem occurs when I call SetBinding on the property Test.  After I call SetBinding, my PropertyBindDialog is no longer used when I want to edit the Test property - the Microsoft BindDialog is used and my custom PropertyBindDialog is ignored.

Anyone out there have any ideas??


namespace MyActivityLibrary


  public partial class MySpecialActivity: Activity, IEventActivity, IActivityEventListener<QueueEventArgs

Custom activity with Flowchart behaviour


Want to create a custom activity which can be used for flowcharting.

Since Flowchart is a sealed class, We tried implementing "IActivityTemplateFactory" and returning a flowchart activity instance, however the custom properties that we have defined in our custom activity are not comming through the property window. We realised that the custom activity is just a flowchart instance.

How can we get the additional properties and behaviours in the custom activity along with flowchart?


image inside custom server control



I want to use an image inside a Custom Web server control ! 

Do I need to use Web.resources ? if so , how to do ?

Inside MSBuild: Compile Apps Your Way With Custom Tasks For The Microsoft Build Engine


Learn how you can use MSBuild to customize your builds. Since it ships as a part of the .NET Framework, you don't even need to have Visual Studio installed on your machine.

Sayed Ibrahim Hashimi

MSDN Magazine June 2006

Custom Validation Attribute is not called by validation mechanism.

Hello everyone I have create custom validation attribute and assign it to class level validation. Unfortunately, it is not called. I try every way that it think it could be solve the problem. However, it take me for hours and I can't find the attribute is not called by validation mechanism.For illustrate you I put the following code.Attribute[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public sealed class BooleanDependencyAttribute : ValidationAttribute { private const string _defaultErrorMessage = "?????????{0}"; private readonly object _typeId = new object(); public string DependencyPropertyName { get; private set; } public string DependentPropertyName { get; private set; } public BooleanDependencyAttribute(string dependencyPropertyName, string dependentPropertyName) : base(_defaultErrorMessage) { DependencyPropertyName = dependencyPropertyName; DependentPropertyName = dependentPropertyName; } public override object TypeId { get { return _typeId; } } public override string FormatErrorMessage(string name) { return String.Format(CultureInfo.CurrentUICulture, ErrorMessageString,name); } public override bool

How to detect that a Data Flow Task has failed (from inside a custom componet)

Hi, in the PostExecute Method of a custom component i would like to check if the Data Flow Task has been failed. Is that possible? Also it would be great to be able to check if this custom component already got all data or has been marked as "green".  Thanks, Dennis

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

Freeform Custom Activity Designers using ICompositeView

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

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.

How to schedule activity loaded from external source inside NativeActivity

I have a NativeActivity that takes an InArgument<int> that is the primary key of some table that contains a piece of xaml. When the activity runs, it loads the xaml from the database and uses ActivityXamlServices to turn the xaml into an activity. Then I try to schedule the activity using NativeActivityContext.ScheduleActivity. This fails with the message: The provided activity was not part of this workflow definition when its metadata was being processed.  The problematic activity named 'Sequence' was provided by the activity named 'RunWorkflowFromStore'. This makes sense because I never added the activity I'm trying to run to the metadata. However, when can I do that? It is only at runtime that I know the value of the primary for the xaml I'm trying to load. Or am I doing this the wrong way? Here is my code: public sealed class RunWorkflowFromStore : NativeActivity<ApprovalState> { private Activity _activity; public InArgument<int> WorkflowId { get; set; } protected override void CacheMetadata(NativeActivityMetadata metadata) { var workflowIdArgument = new RuntimeArgument("WorkflowId", typeof(int), ArgumentDirection.In); metadata.Bind(WorkflowId, workflowIdArgument); metadata.AddArgument(workflowIdArgument); } protected override void Execute(NativeActivityContext context) { // Load activity

Access Model Validation inside Custom Model Binder.

Hello,Is it possible, inside a Custom Model Binder, to fire "something" that "says" the value is invalid so it gets handled by validation part?Basically, I am getting an exception when the value for the property is invalid.Thank You,Miguel

Why can't set a Variable from an InArgument inside of CacheMetadata?

I want to set the defaults for the my arguments and variables the way I see fit. But, this throws an exception. Why?   using System; using System.Activities; using System.Linq.Expressions; namespace ConsoleApplication5 { class Program { static void Main(string[] args) { var wf = new Foo() { }; WorkflowInvoker.Invoke(wf); } } public class Foo : NativeActivity { public InArgument<int> __in { get; set; } public OutArgument<int> __out { get; set; } public Variable<int> __var { get; set; } protected override void CacheMetadata(NativeActivityMetadata metadata) { //provide defaults in this way -> out and variable are equal to in. __in = new InArgument<int>(10); __var = new Variable<int>(context => __in.Get(context)); __out = new OutArgument<int>(context => __in.Get(context)); var rout = new RuntimeArgument("__out", typeof(int), ArgumentDirection.Out); metadata.Bind(__out, rout); var rin = new RuntimeArgument("__in", typeof(int), ArgumentDirection.In); metadata.Bind(__in, rin); metadata.AddImplementationVariable(__var); metadata.AddArgument(rin); metadata.AddArgument(rout); } protected override void Execute(NativeActivityContext context) { } } }   The exception is: System.Activities.InvalidWorkflowException was unhandled   Message=The fol

Create task activity break out inside a While loop

Hi I have developed a sharepoint state machine workflow. I want to assign a same task to more than one users, but unfortunatly, I cannot give the attribute "AssignTo" to more users in the code, even like this:"this.workflowTask1Properties.AssignedTo = "mydomain\\user01;mydoman\\user02", that will result in an empty value to the attribure.So, I involved the createtask activity in a While loop so I can asign deferent user in each loop, but It's very stange,  the loop always stopped in the second time, does anybody have met this issue?I have referensed Amit's question:http://social.msdn.microsoft.com/forums/en-US/windowsworkflowfoundation/thread/b238978d-f330-420c-823e-b77b0e19414d?prof=requiredbut I have no define the "correlation refernce " in my workflow.my code is here:public SPWorkflowTaskProperties workflowTask1Properties;public int abc;...private void OnWorkflowActivated(object sender, ExternalDataEventArgs e)        {            ...           this.abc = 0;           ...        }...private void CreateTask1(object sender, EventArgs e)        { 
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