locked
help with binging path for workflowitemspresenter designer on xaml workflow RRS feed

  • Question

  • Hey Guys

    I hope someone is smarter than me.  I have a xaml non code based workflow.  This workflow contains a custom activity a switch and a couple sequences where additional activities can be dropped. 

    I have reviewed the beta 2 samples using parallel, however this is back ended with a code activity not xaml workflow.

    Now I try and build a custom designer using the workflowItemsPresenter to collect the activities for the sequence.  When I look at the modelitem on load, I am unable to determine the binding path to the sequence element as it does not appear as a valid property.  Secondly my first custom activity does not appear as a valid property to bind the custom designer to that I have built for this activity.

    Can anyone provide any insight as to why the elements of the xaml workflow do not appear in the modelitem hiarchy?

    thanks.

    Matthew
    Matthew Christopher
    Thursday, November 5, 2009 10:50 PM

All replies

  • Matthew,

    I think what you are looking to do is something that we've called the "grey box" scenario in the past, where you author an activity that has "holes" in it.   The way to enable this is through using ActivityAction (I've got a blog post coming on this), and building a designer for that activity that exposes those ActivityActions.

    The reason that you don't see the activiteis of the XAML workflow is that they get compiled as the internal implementation details of your activity type. 

    Could you post a small snippet of the XAML for what you are trying to accomplish (the activity where you want additional items to be dropped)?

    matt

    Program Manager -- wf designer -- http://blogs.msdn.com/mwinkle
    Thursday, November 5, 2009 11:46 PM
  • Below is the example to illustrate what I am trying to do.  I am trying to show the designer for the range evaluation, followed by 3 sequence boxes where users can drop the various activities that they would like to complete depending on criticality level.  This is of course simplified however if I can get this working the rest are all variations on a theme.

    <Activity mc:Ignorable="sap" x:Class="ActivityLibrary.ActionOnRangeEvaluation" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:local="clr-namespace:ActivityLibrary" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:shsbd="clr-namespace:DataTransferDefinitions;assembly=DataTransferDefinitions" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
      <x:Members>
        <x:Property Name="data" Type="InArgument(shsbd:DataRecord)" />
      </x:Members>
      <mva:VisualBasic.Settings>Assembly references and imported namespaces serialized as XML namespaces</mva:VisualBasic.Settings>
      <Sequence DisplayName="Data Submission Record Range Actions" sad:XamlDebuggerXmlReader.FileName="D:\ActivityLibrary\ActionOnRangeEvaluation.xaml" sap:VirtualizedContainerService.HintSize="495,777">
        <Sequence.Variables>
          <Variable x:TypeArguments="x:String" Default="[&quot;Normal&quot;]" Name="SeverityEvaluation" />
        </Sequence.Variables>
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <local:RangeEvaluation CurrentRange="[SeverityEvaluation]" DisplayName="Range Evaluation" HighCritical="0" HighWarning="0" sap:VirtualizedContainerService.HintSize="473,336" InputDataRec="[data]" LowCritical="0" LowWarning="0" />
        <Switch x:TypeArguments="x:String" DisplayName="Normal, Warning, Critical" Expression="[SeverityEvaluation]" sap:VirtualizedContainerService.HintSize="473,277">
          <Sequence x:Key="Normal" DisplayName="NormalActivitySequence" sap:VirtualizedContainerService.HintSize="453,100">
            <sap:WorkflowViewStateService.ViewState>
              <scg:Dictionary x:TypeArguments="x:String, x:Object">
                <x:Boolean x:Key="IsExpanded">True</x:Boolean>
              </scg:Dictionary>
            </sap:WorkflowViewStateService.ViewState>
          </Sequence>
          <Sequence x:Key="Warning" DisplayName="WarningActivitySequence" sap:VirtualizedContainerService.HintSize="453,100">
            <sap:WorkflowViewStateService.ViewState>
              <scg:Dictionary x:TypeArguments="x:String, x:Object">
                <x:Boolean x:Key="IsExpanded">True</x:Boolean>
              </scg:Dictionary>
            </sap:WorkflowViewStateService.ViewState>
          </Sequence>
          <Sequence x:Key="Critical" DisplayName="CriticalActivitySequence" sap:VirtualizedContainerService.HintSize="453,100">
            <sap:WorkflowViewStateService.ViewState>
              <scg:Dictionary x:TypeArguments="x:String, x:Object">
                <x:Boolean x:Key="IsExpanded">False</x:Boolean>
                <x:Boolean x:Key="IsPinned">False</x:Boolean>
              </scg:Dictionary>
            </sap:WorkflowViewStateService.ViewState>
          </Sequence>
        </Switch>
      </Sequence>
    </Activity>

    Matthew Christopher
    Friday, November 6, 2009 2:08 PM
  • Below is the starting point for my designer however the binding paths and how to set them are perplexing me.

    <sad:ActivityDesigner x:Class="ActivityDesignerLibrary.ActionOnRanceEvaluationDesigner"
                          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                          xmlns:sad="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
                          xmlns:sadv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
                          xmlns:my="clr-namespace:ActivityDesignerLibrary">
        <sad:ActivityDesigner.Resources>
            <DataTemplate x:Key="Collapsed">
                <TextBlock>This is the Collapsed View of my custom designer</TextBlock>
            </DataTemplate>
            <DataTemplate x:Key="Expanded">
                <StackPanel>
                    <TextBlock HorizontalAlignment="Center">This is the</TextBlock>
                    <TextBlock HorizontalAlignment="Center">extended view</TextBlock>
                    <!--<my:RangeEvaluationDesigner
                                                HorizontalAlignment="Left"
                                               
                                                x:Name="rangeEvaluationDesigner1"
                                                VerticalAlignment="Top"
                       
                        />
                    <StackPanel Orientation="Horizontal">-->
                    <sad:WorkflowItemsPresenter HintText="Drop Normal Activities Here"
                                                Items="{Binding Path=ModelItem.Normal.Activities}">
                            <sad:WorkflowItemsPresenter.SpacerTemplate>
                                <DataTemplate>
                                    <Ellipse Width="10"
                                             Height="10"
                                             Fill="Black" />
                                </DataTemplate>
                            </sad:WorkflowItemsPresenter.SpacerTemplate>
                            <sad:WorkflowItemsPresenter.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Vertical">
                                      
                                    </StackPanel>
                                </ItemsPanelTemplate>
                            </sad:WorkflowItemsPresenter.ItemsPanel>
                        </sad:WorkflowItemsPresenter>
                 <!--       <sad:WorkflowItemsPresenter HintText="Drop Warning Activities Here"
                                                    Items="{Binding Path=ModelItem.Warning}">
                            <sad:WorkflowItemsPresenter.SpacerTemplate>
                                <DataTemplate>
                                    <Ellipse Width="10"
                                             Height="10"
                                             Fill="Black" />
                                </DataTemplate>
                            </sad:WorkflowItemsPresenter.SpacerTemplate>
                            <sad:WorkflowItemsPresenter.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Vertical">
                                      
                                    </StackPanel>
                                </ItemsPanelTemplate>
                            </sad:WorkflowItemsPresenter.ItemsPanel>
                        </sad:WorkflowItemsPresenter>
                        <sad:WorkflowItemsPresenter HintText="Drop Critical Activities Here"
                                                        Items="{Binding Path=ModelItem.Critical}">
                            <sad:WorkflowItemsPresenter.SpacerTemplate>
                                <DataTemplate>
                                    <Ellipse Width="10"
                                             Height="10"
                                             Fill="Black" />
                                </DataTemplate>
                            </sad:WorkflowItemsPresenter.SpacerTemplate>
                            <sad:WorkflowItemsPresenter.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Vertical">
                                       
                                    </StackPanel>
                                </ItemsPanelTemplate>
                            </sad:WorkflowItemsPresenter.ItemsPanel>
                        </sad:WorkflowItemsPresenter>
                    </StackPanel>
                                -->
                      
                </StackPanel>
            </DataTemplate>
            <Style x:Key="ExpandOrCollapsedStyle"
                   TargetType="{x:Type ContentPresenter}">
                <Setter Property="ContentTemplate"
                        Value="{DynamicResource Collapsed}" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=ShowExpanded}"
                                 Value="true">
                        <Setter Property="ContentTemplate"
                                Value="{DynamicResource Expanded}" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </sad:ActivityDesigner.Resources>
        <Grid>
           
            <ContentPresenter Style="{DynamicResource ExpandOrCollapsedStyle}"
                              Content="{Binding}" />
          
        </Grid>
        </sad:ActivityDesigner>

    Matthew Christopher
    Friday, November 6, 2009 2:28 PM
  • Hi Matthew,

    Just wanted to say the only way I know to get scenario where you want a 'fill-in-the-blanks area' in your activity working is by writing the outer activity in code, subclassing NativeActivity. The fill-in-the-blanks area can either be done with a property of type Activity, or ActivityAction and it's relatives.

    Tim
    Monday, January 4, 2010 6:59 PM