Xamarin.forms 拖放Xamarin窗体

Xamarin.forms 拖放Xamarin窗体,xamarin.forms,drag-and-drop,Xamarin.forms,Drag And Drop,我们希望在Xamarin表单中实现拖放功能 在这种情况下,用户应该能够从一个地方拖动表情符号,然后放到另一个地方。不过,我们不希望源表情符号消失,应该能够知道对哪个员工进行了评级 问题亦载于: 我们已经检查了以下几个链接,但它们似乎都不起作用: 如果您能获得一些关于如何操作的提示,即使这在表单上是可能的,我们将不胜感激。您可以查看下面的代码 xaml: 截图: 您可以检查代码项目中的源文件以供参考。 <StackLayout Margin="10">

我们希望在Xamarin表单中实现拖放功能

在这种情况下,用户应该能够从一个地方拖动表情符号,然后放到另一个地方。不过,我们不希望源表情符号消失,应该能够知道对哪个员工进行了评级

问题亦载于:

我们已经检查了以下几个链接,但它们似乎都不起作用:


如果您能获得一些关于如何操作的提示,即使这在表单上是可能的,我们将不胜感激。

您可以查看下面的代码

xaml:

截图:

您可以检查代码项目中的源文件以供参考。

<StackLayout Margin="10">

        <StackLayout Margin="10" Orientation="Horizontal">
            <components:DragAndDropSample3ReceivingView
                BackgroundColor="Beige"
                HeightRequest="80"
                WidthRequest="80" />
            <components:DragAndDropSample3ReceivingView
                BackgroundColor="Beige"
                HeightRequest="80"
                WidthRequest="80" />
            <components:DragAndDropSample3ReceivingView
                BackgroundColor="Beige"
                HeightRequest="80"
                WidthRequest="80" />

        </StackLayout>
        <BoxView
            BackgroundColor="Blue"
            HeightRequest="5"
            WidthRequest="3" />
        <StackLayout Margin="10" Orientation="Horizontal">

            <components:DragAndDropSample3MovingView
                BackgroundColor="Red"
                CornerRadius="40"
                HeightRequest="40"
                WidthRequest="40" />
            <components:DragAndDropSample3MovingView
                BackgroundColor="Green"
                CornerRadius="40"
                HeightRequest="40"
                WidthRequest="40" />
        </StackLayout>

    </StackLayout>
 public void OnDropReceived(IDragAndDropMovingView view)
    {
        if (view is DragAndDropSample3MovingView sender)
        {
            var control = new DragAndDropSample3MovingView()
            {
               BackgroundColor=sender.BackgroundColor,
               CornerRadius=sender.CornerRadius,
               WidthRequest=sender.WidthRequest,
               HeightRequest=sender.HeightRequest,                 
              
            };
            Content = control;


        }

    }