开发者

Drag a custom activity in a re-hosted workflow designer

开发者 https://www.devze.com 2023-03-09 01:38 出处:网络
Hello I have a problem in my Design which is in this http://archive.msdn.microsoft.com/wfxbap/Release/ProjectReleases.aspx?ReleaseId=4668

Hello I have a problem in my Design which is in this http://archive.msdn.microsoft.com/wfxbap/Release/ProjectReleases.aspx?ReleaseId=4668

I have made a custom activity in my Re-hosted workflow designer in WPF, and I make this custom activity shows in the end-user toolbar with the other activites, but the custom one can't be drop into the sequence at all like other activities.

I put the AllowDrop="True" in the .XAML file and the following in the .cs file:

    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.Cont开发者_如何学编程ext);

        ModelItem canvasActivity = this.ModelItem;

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

        e.Handled = true;

        DragDropHelper.SetDragDropCompletedEffects(e, DragDropEffects.Move);

        base.OnDrop(e);

    }

Any help please?


I realize this post is old but I just ran across this problem as well so thought I would post for anyone else who stumbles upon this. I found that adding your custom Activity library to the same binary path as your rehosted designer should do the trick.

0

精彩评论

暂无评论...
验证码 换一张
取 消