C# Windows工作流序列活动的设计器源代码是否可供参考?

C# Windows工作流序列活动的设计器源代码是否可供参考?,c#,workflow,C#,Workflow,Re sharper能够从工作流中找到序列活动本身的源代码。在查看System.dll项目引用时,我看不到设计器是如何链接的。我本来希望在某个地方找到一个对AttributeTableBuilder的引用,并调用AddCustomAttributes,就像对自定义设计器的活动所做的那样 序列活动设计器的设计器源代码是否在internet上的某个位置可用?我希望看看它,了解微软是如何设计序列用户界面的。我尝试用谷歌搜索它,但只找到了有关构建自定义活动设计器的信息。如果您想实现与内置序列活动相同的效

Re sharper能够从工作流中找到序列活动本身的源代码。在查看System.dll项目引用时,我看不到设计器是如何链接的。我本来希望在某个地方找到一个对AttributeTableBuilder的引用,并调用AddCustomAttributes,就像对自定义设计器的活动所做的那样


序列活动设计器的设计器源代码是否在internet上的某个位置可用?我希望看看它,了解微软是如何设计序列用户界面的。我尝试用谷歌搜索它,但只找到了有关构建自定义活动设计器的信息。

如果您想实现与内置序列活动相同的效果,自定义活动是正确的选择,您应该使用WorkflowItemsPresenter,此示例将结果显示为内置序列活动:
活动设计器xaml:

<sap:ActivityDesigner x:Class="ProjectForm2.ActivityDesigner1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation">
<sap:ActivityDesigner.Resources>
     <Style x:Key="WorkflowItemsPresenterStyle" TargetType="sap:WorkflowItemsPresenter">
            <Setter Property="SpacerTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Border Background="Transparent">
                            <Path Data="F1M181.297,177.841L181.205,177.746 181.385,177.563 202.804,156.146 202.804,135.07 178.497,159.373 170.847,167.026 170.666,167.205 163.107,159.653 138.804,135.345 138.804,156.42 160.219,177.841 170.76,188.379 181.297,177.841z" 
                      Stretch="Uniform" Fill="#FFDEDDDD" 
                      Width="15" Height="15" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5"/>
                        </Border>

                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate >
                        <StackPanel  Orientation="Vertical"/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
        </Style>
</sap:ActivityDesigner.Resources>
<Grid>
    <Grid.Resources>

    </Grid.Resources>
    <sap:WorkflowItemsPresenter Style="{StaticResource WorkflowItemsPresenterStyle}" AllowDrop="True"   Items="{Binding Path=ModelItem.Activities}"  HintText="Insert here">

    </sap:WorkflowItemsPresenter>
</Grid>

活动类别:

  [Designer(typeof(ActivityDesigner1))]
  public sealed class CodeActivity1 : CodeActivity
{
    public CodeActivity1()
    {
          Activities = new List<Activity>();
        Activities.Add(new Assign());
        Activities.Add(new Assign());
    }
   public List<Activity> Activities { get; set; }

    protected override void Execute(CodeActivityContext context)
    {
    }
}
[设计器(类型化(活动设计器1))]
公共密封类CodeActivity 1:CodeActivity
{
公共代码活动1()
{
活动=新列表();
添加(新分配());
添加(新分配());
}
公共列表活动{get;set;}
受保护的覆盖无效执行(CodeActivityContext上下文)
{
}
}

设计器存在于System.Activities.Core.Presentation.dll中,如果将其添加到您使用的项目中,可以使用Re Sharper浏览到: System.Activities.Core.Presentation.SequenceDesigner

设计器与DesignerMetadata类中的AtributeTableBuilder映射: 系统.活动.核心.展示.设计数据

您还可以在以下位置查看c代码:

我后来发现的一个有趣的方法是,您可以直接使用序列的设计器,如本文所述


我还没有找到真正的XAML…看到真正的东西会很有趣。

嘿,谢谢你的XAML样本。很接近,但与真品不太一样。我玩过它,并做了一个更改,使分隔符图标更像真实的东西: