locked
Flowchart activity within an ActivityBuilder not expanding to fill available space? RRS feed

  • Question

  • In my rehosted designer app, I'm using an ActivityBuilder and setting it's Implementation to a "Flowchart".  I'd like the Flowchart to expand to fill the entire space available in the ActivityBuilder, but can not figure out how to do that ... any ideas?

    Wednesday, October 6, 2010 11:04 PM

Answers

  • the large margin is caused by activity builder.

    unfortunately it's by designer.

    if you can't solve it by enlarge flowchart's wideth and height, the only way as I know is you create your own activity builder designer to avoid this sapce.

    • Marked as answer by Andrew_Zhu Thursday, October 14, 2010 6:56 AM
    Sunday, October 10, 2010 2:56 AM

All replies

  • are you seeing a small rectangle with "Flowchart" on it?

    I guess you are forgoting following code

    new DesignerMetadata().Register;

    you need to put it in your rehost app

    some sample code like this

    new DesignerMetadata().Register();

    WorkflowDesigner designer = new WorkflowDesigner();

    ActivityBuilder builder = new ActivityBuilder();

    builder.Implementation = new Flowchart();

    designer.Load(builder);

    you can find DesignerMetaData at System.Activities.Core.Presentation.dll

     

    if this is not the case you meet, and you just want to make the flowchart designer bigger than its original size, you can use following code to set its width and height when it's loaded

      Window win = new Window();
                new DesignerMetadata().Register();
                WorkflowDesigner designer = new WorkflowDesigner();
                ActivityBuilder builder = new ActivityBuilder();
                builder.Implementation = new Flowchart();
                designer.Load(builder);
                ModelItem flowchart = designer.Context.Services.GetService<ModelService>().Root.Properties["Implementation"].Value;
                designer.Context.Services.GetService<ViewStateService>().StoreViewStateWithUndo(flowchart, "Width", 1000.00);
                designer.Context.Services.GetService<ViewStateService>().StoreViewStateWithUndo(flowchart, "Height", 1000.00);

                win.Content = designer.View;
                win.ShowDialog();

    Thursday, October 7, 2010 1:05 AM
  • Thanks - I see how this works well for the default Flowchart activity - the size is adjusted.  I didn't mention in my first post that I'm actually using a custom Flowchart activity ... that has a custom ActivityDesigner.  The custom designer is actually built very closely to the MS default implementation, but for some reason setting that Viewstate isn't affecting the size. 

    Do u have any suggestions?  When you set the "Width" and "Height" in the view state method call, are those width/height properties on the Flowchart activity designer?  I'm just wondering because there actually seems to be FlowchartWidth and FlowchartHeight properties.

    One other thing - there seems to be a large margin/padding around the Flowchart activity in the ActivityBuilder ... is there a way to position that differently or remove that margin?

    Thursday, October 7, 2010 6:54 PM
  • so you are using your custom flowchartdesigner, right?

    the wideth and height is the property of the built-in flowchartdesigner.

    so if your using your own, you need to bind your flowchart designer width and height to some viewstate info.

    One other thing - there seems to be a large margin/padding around the Flowchart activity in the ActivityBuilder ... is there a way to position that differently or remove that margin?

    I can't understand what you mean.

    can you give me more detail?

    Thursday, October 7, 2010 7:06 PM
  • Ok nice, I think I have the ViewState height/Width issue worked out.

    As for the margin issue I was talking about, I've posted a link to a screenshot:

    http://www.box.net/shared/32pdc6xgzi

    Basically you'll see that the Flowchart doesn't line up to the very top or left edges of the space available inside the ActivityBuilder ... I'm not sure where the seemingly arbitrary activity positioning is coming from.

    Thursday, October 7, 2010 10:47 PM
  • the large margin is caused by activity builder.

    unfortunately it's by designer.

    if you can't solve it by enlarge flowchart's wideth and height, the only way as I know is you create your own activity builder designer to avoid this sapce.

    • Marked as answer by Andrew_Zhu Thursday, October 14, 2010 6:56 AM
    Sunday, October 10, 2010 2:56 AM