在重新托管的工作流设计器中拖动自定义活动

时间:2011-05-27 20:18:40

标签: wpf

您好 我的设计中有一个问题,就是http://archive.msdn.microsoft.com/wfxbap/Release/ProjectReleases.aspx?ReleaseId=4668

我在WPF中的重新托管的工作流设计器中进行了自定义活动,并且我使用其他活动在最终用户工具栏中显示此自定义活动,但是自定义活动不能放入序列中就像其他活动一样。

我将.DAML文件中的AllowDrop =“True”和.cs文件中的以下内容放在一起:

    protected override void OnDragEnter(DragEventArgs e)
    {

        //Check the object is actually something we want to be droppable

        if (DragDropHelper.AllowDrop(

                e.Data,

                this.Context,

                typeof(Activity)))
        {

            e.Effects = (DragDropEffects.Move & e.AllowedEffects);

            e.Handled = true;

        }

        base.OnDragEnter(e);

    }



    protected override void OnDragOver(DragEventArgs e)
    {

        //Check the object is actually something we want to be droppable

        if (DragDropHelper.AllowDrop(

                e.Data,

                this.Context,

                typeof(Activity)))
        {

            e.Effects = (DragDropEffects.Move & e.AllowedEffects);

            e.Handled = true;

        }

        base.OnDragOver(e);

    }



    protected override void OnDrop(DragEventArgs e)
    {

        //droppedItem - may be a ModelItem or a newly instantiated object (from toolbox)

        object droppedItem = DragDropHelper.GetDroppedObject(this, e, this.Context);

        ModelItem canvasActivity = this.ModelItem;

        canvasActivity.Properties["Children"].Collection.Add(droppedItem);

        e.Handled = true;

        DragDropHelper.SetDragDropCompletedEffects(e, DragDropEffects.Move);

        base.OnDrop(e);

    }

请帮忙吗?

1 个答案:

答案 0 :(得分:0)

我意识到这篇文章已经老了,但我也遇到了这个问题,所以我想我会发布其他任何偶然发现这个问题的人。我发现将自定义活动库添加到与重新设计的设计器相同的二进制路径应该可以解决问题。

相关问题