.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

Undo After Adding Activity Which Causes Designer Resize

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :Windows Application
Hi, I created a very simple test application which consists of a Toolbox and a Workflow Designer.  In the toolbox, I only added a "Terminate" activity: public MainWindow() { InitializeComponent(); new System.Activities.Core.Presentation.DesignerMetadata().Register(); _workflowDesigner = new WorkflowDesigner(); Grid.SetColumn(_workflowDesigner.View, 1); _workflowDesigner.Load(new System.Activities.Statements.Flowchart()); LayoutGrid.Children.Add(_workflowDesigner.View); _toolbox = new ToolboxControl(); ToolboxCategory undoTestCategory= new ToolboxCategory("Undo Test"); ToolboxItemWrapper terminateTool = new ToolboxItemWrapper(typeof(System.Activities.Statements.TerminateWorkflow), "Terminate"); undoTestCategory.Add(terminateTool); _toolbox.Categories.Add(undoTestCategory); Grid.SetColumn(_toolbox, 0); LayoutGrid.Children.Add(_toolbox); } When I drag/drop the "Terminate" to the middle of the designer, I can press Ctrl-Z once to undo it (i.e. remove it from the designer).  However, if I drop it at the edge of the designer which forces a resize/expansion of the designer, it takes 4 Ctrl-Zs to undo it.  Is there a way around this?  Also, is there an easy way in the debugger to see the undo stack? Thank you.  

View Complete Post

More Related Resource Links

Customer Activity Designer Problem - "Could not generate view for VisualBasicValue`1"

I'm reading Bruce Bukovics Pro WF4 book and in chapter 16 - Advanced Customer Activites, he details emulating a Sequence activity along with a custom designer. When I drop the custom activity into a new xaml activity, I'm getting all sorts of wierdness. The custom sequence activity has a condition property that determines whether to schedule each child activity contained within. Once I set a value in the ExpressionTextBox for the activity, Visual Studio starts showing in red "Could not generate view for VisualBasicValue`1" along with this error showing up in my error window: The activity 'VisualBasicValue<Boolean>' cannot be referenced by activity 'MySequence' because the latter is not in another activity's implementation.  An activity can only be referenced by the implementation of an activity which specifies that activity as a child or import.  Activity 'VisualBasicValue<Boolean>' is declared by activity 'MySequence'. Here is the source for the activity itself: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Activities; using System.ComponentModel; using System.Collections.ObjectModel; namespace ActivityLibrary { [Designer(typeof(ActivityLibrary.Design.MySequenceDesigner))] public sealed class MySequence : NativeActivity { [Browsable(false)] public Collection<Activity&

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 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.

Sharepoint Designer: ErrorMessage in Designview after adding new PlaceHolder to masterpage

Hi! I added a new PlaceHolder to the masterpage of my SharePoint-Site. Now when I switch to DesignView of a page which uses this masterpage in SPD most of the other PlaceHolders are not displayed and show a error message like "Error on creating control. Response is not available in this context". How do I prevent this problem? And what is the cause? Thank you very much for answers! Gerrit

How to directly open activity on rehosted designer

Hello Everyone,      Let's say you have a rehosted designer that contains activities within activities.  Some of these activities are not shown on the designer because of the nesting.  Now lets say you know the name of one of the hidden nested activities and want to programmatically open the DesignView to this one activity.  How would one do this?  I was thinking about creating a miniature visual tree showing every activity in the workflow.  Clicking on an item in this mini-tree would open the main designer to that activity, this would allow for quick navigation to deeply nested activities.  Is this possible, or am I hopelessly delusional?  I'm thinking the tree itself could be fairly easily built from the xaml text itself, however causing the designer window to switch to an arbitrary activity view may be another matter. Thanks in advance everyone, Bob

SharePoint Designer adding __designer attributes

Hi, I am hoping someone knows a why to shut this functionality off. Everytime I open my master page in SharePoint designer it adds __designer:Preview and __designer:Values attributes to my FieldValue and Literal controls, and if I don't remove them before I check in ASP.NET complains. Does anyone know how to stop SharePoint designer from doing this or is there an attribute I can set on the controls to stop it? <SharePoint:FieldValue FieldName="Title" runat="server" __designer:Preview="XXXXX" __designer:Values="XXXXX"/> Thanks in advance.

Disable an activity in Designer at run time in workflow 4.0

There are couple of activities in my workflow & based on some condition, I need to make an activity disabled i.e. I don't want that activity to be seletable by the user. I am opening my workflow in designer at run time to give an overview of WF to the user. Something like  (new DesignerMetadata()).Register(); this.wd = new System.Activities.Presentation.WorkflowDesigner(); this.designerSection.Child = (this.wd.View); I was going thru the MS sample of CommentOut Activity but that won't solve my requirement as Activity needs to be disabled at run time based on some condition.

Adding a table or view multiple times when building a query with BI Report Designer and Report Build

How can I add a table/view multiple times to a single query by using BI Report Designer or Report Builder 3.0? In Report Designer I managed (workaround) to add one table multiple times by creating multiple Named Queries and having the same SELECT. Still I don't know how to add one table multiple times in Report Builder 3.0.

sharepoint designer keeps adding unwanted tags

I have a page where I want this code:
<p class="AlignLeft">ASPvalidation<br />
<asp:ValidationSummary id="vsErrors" Runat="server" CssClass="AlertText" DisplayMode="BulletList" EnableClientScript="True" HeaderText="Error Summary" ValidationGroup="loginValidationGroup" />
<asp:CustomValidator id="cvAuthentication" Runat="server" Display="None" EnableClientScript="False" ErrorMessage="Login ID or Password Is Invalid" OnServerValidate="cvAuthentication_ServerValidate" ValidationGroup="loginValidationGroup" />

But each time I press save SPD adds a <p> and hoses my code to this..................
<p class="AlignLeft">ASPvalidation<br />
<asp:ValidationSummary id="vsErrors" Runat="server" CssClass="AlertText" DisplayMode="BulletList" EnableClientScript="True" HeaderText="Error Summary" ValidationGroup="loginValidationGroup" />
<asp:CustomValidator id="cvAuthentication" Runat="server" Display="None" EnableClientScript="False" ErrorMessage="Login ID or Password Is Invalid" OnServe

Adding a server control on aspx page does not add events in aspx.designer.vb file



I work in VS 2008. Whenver I add a server control(Label) and set it properties in aspx.vb and build the solution, I get the error "Label1 not declared". While analyzing this issue I noticed that the event handler statements for the Label1 where not added in the designer.asp.vb file. These statement would actually be added automatically when I drag and drop a control to my webpage.

I would also like to inform the scenario after which this problem came to me. I was working in VS 2008 , VS 2005 and VS 2003 in the same machine.Could this have caused the issue ? Please advise.

Now each and everytime when I add a control, I am adding the "With Events" code in the designer page to make my build succesfull which makes me to spend more efforts.

Please advise if any settings have to be changed.



Failed to display the IActivityTemplateFactory designer as a root activity on the rehosted applicati


Hi guys,

I have created a custom composite activity that derived from the Activity and IActivityTemplateFactory. When I try to deploy this composite activity as a root activity on the rehosted application. It failed to display its designer probably. If I put a sequence as a root activity, and the composite activity as a child activity inside the sequence activity,  I got my composite activity designer display nicely on my rehosted designer. Is it a limitation for us to put a IActivityTemplateFactory designer as root activity in the rehosted app. Please advice.


public class CustomCompositeActivity : Activity, IActivityTemplateFactory
  public Activity Create(System.Windows.DependencyObject target)

    return new Sequence
       Activities = 
          new WriteLine
            Text = "Hello"
          new WriteLine
            Text = "WF 4.0"

Can we specify ChromeType Property of a web part when adding in SharePoint Designer 2010

Is it possible that with all other properties, we can specify ChromeType Property of a web part while adding it on the page using SharePoint Designer 2010? If yes, any example / syntax?

Adding a JavaScript to SharePoint Page with SharePoint Designer


I am trying to add a javascript to a single SharePoint page. This script will only be used on this one page so I do not want to put it in the master page. I saved the the scritp to a document library on my site. Using SharePoint Designer, I opened the page on which the script should reside. I put the tag script tag at the first place I could. When I save the page, I get this error:

Content in the embedded form field may be changed by the server to remove unsafe content. Do you want to reload your page to see the results of the save?

After clicking Yes, the script tag is gone. How do I add this script to my page?

SharePoint Designer Workflow Activity to generate Word Document from Infopath xml




I am considering the follow implementation.

I have a workflow that user fills out to get funding and once approved (via workflow) I want to at the end of the approval generate the letter dynamically based on the values out of the infopath form.

Now I am thinking of the following solutions.

A custom activity where you point it to the word document to use and then set the fields out of the infopath that you want transfered into the word document.

Is this going to be even possible.

The type of data I have is fields from lookup, people pickers, text, curreny etc.

Is there another option maybe having a document lib with these fields as text and create new item in it and move these values into there (is that possible via designer?)


The document has to be able to be easily editable by the end user to change the template and also to be able to edit the actual document once created.


Any help would be great.

the joy of writing a custom workflow activity for SharePoint Designer...


So, I need an activity that will replace some old text into new text in a given string.
Not present OOTB in SharePoint Designer, so - oh boy! oh boy! - we can develop it ourselves using Visual Studio!

Ok great, I did some reading about it on SP2007 in the past, but never needed it, so never actually tried it.
Now I'm on SP2010, so I googled again to find guides on how to write my very first custom workflow activity to use in SharePoint Designer 2010.
Nothing to be found.... The few posts about 2010 were only stating that it works still the same as in SP2007, and to look for guides on 2007.

Ok, so I googled some guides on how to do this in SP2007. I found one from MSDN, perfect to start with you'd say: http://msdn.microsoft.com/en-us/library/cc627284.aspx 
But really, it doesn't work the same... When I create an Activity Library project in VS2010, I don't have a class, like in the guide. All I have is a xaml file, no cs at all, and I have absolutely no clue what I should add in order to get the same class as in the guide. Adding a regular class is not it, since in the guide they're using a partial class. So I'm blocked 5secs after I started reading the guide... just great.

I'm so fed up with the lack of information on development for SharePoint. I hit

Error when adding one instance of activity multiple time into Sequence activity



Hi all, 

I encounter this error when I tried to add same Writeline instance into two different Sequence activities as shown in the code below:


      ActivityBuilder ab = XamlServices.Load(ActivityXamlServices.CreateBuilderReader(new XamlXmlReader(new StringReader(_designer.Text)))) as ActivityBuilder;
      //inspecting ab ...
      Console.WriteLine("There are {0} arguments in the activity builder.", ab.Properties.Count);
      //ProcessActivity(ab.Implementation, "");
      //test code to add two same instances of activities in a sequence and execute them 
      if(ab.Implementation is Sequence)
        Sequence seq = ab.Implementation as Sequence;

Problem when adding activities in SharePoint Designer 2010



I have a problem while adding custom activities in a workflow with SharePoint Designer 2010. My activities are deployed by a global package that also contains features, web pages, activities. This packages work correctly on another server.

I add a new reusable workflow, then in the list of actions, I select my custom action but it is not added to the workflow. I don’t get any error message.

I added authorizedType in web.config.
My assemblies were deployed in the GAC.
In my package, I have web pages that use the assembly used by my custom activities and it works fine.

I also deleted temporary

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