public void OnDropReceived(IDragAndDropMovingView view) { if (view is DragAndDropSample3MovingView sender) { BackgroundColor = sender.BackgroundColor; } }
public void OnDropReceived(IDragAndDropMovingView view) { if (view is DragAndDropMovingView sender) { BackgroundColor = sender.BackgroundColor; turtle.cleanOcean(); } }
public void OnDropReceived(IDragAndDropMovingView view) { if (view is DragAndDropSample3MovingView sender) { BackgroundColor = sender.BackgroundColor; //new MainPage().UpdateUI(); MessagingCenter.Send <App>((App)Application.Current, "CallMethod"); } }
private static VisualElement GetContainer(this IDragAndDropMovingView view) { if (!(view is VisualElement visualElement)) { throw new Exception($"{nameof(IDragAndDropMovingView)} can only be an interface on a {nameof(View)}"); } var dropContainer = visualElement.GetFirstParentOfType <IDragAndDropContainer>(); if (dropContainer is VisualElement output) { return(output); } return(visualElement.GetFirstParentOfType <Page>()); }
public static void InitializeDragAndDrop(this IDragAndDropMovingView view) { if (!(view is View output)) { throw new Exception($"{nameof(IDragAndDropMovingView)} can only be an interface on a {nameof(View)}"); } var panGestureRecognizer = new PanGestureRecognizer { TouchPoints = 1 }; panGestureRecognizer.PanUpdated += PanGestureRecognizer_PanUpdated; output.GestureRecognizers.Clear(); output.GestureRecognizers.Add(panGestureRecognizer); }
private static void DragAndDroppableViewDropped(this VisualElement view, IDragAndDropMovingView sender) { var allReceivers = view.GetAllChildrenOfType <IDragAndDropReceivingView>(); foreach (var receiver in allReceivers) { if (!(receiver is VisualElement veReceiver)) { continue; } var x = veReceiver.GetScreenCoordinates().X; var y = veReceiver.GetScreenCoordinates().Y; var width = veReceiver.Width; var height = veReceiver.Height; if (sender.ScreenX >= x && sender.ScreenX <= x + width && sender.ScreenY >= y && sender.ScreenY <= y + height) { receiver.OnDropReceived(sender); } } }