private void SubscribeToDragNDropEvents() { DragDropHandler.DragStarted += (s, e) => { Log("Drag started !"); }; DragDropHandler.DragUpdated += (s, e) => { Log($"Drag updated ! newX : {e.Position.X}, newY : {e.Position.Y}"); }; DragDropHandler.DragEnded += (s, e) => { Log("Drag ended !"); IList <BlockViews.ContainerBlockView> coveredBlockViews = GetContainerBVsCoveredByDragged(e); if (coveredBlockViews.Count != 0 && e.Block is BlockViews.SimpleBlockView) { BlockViews.SimpleBlockView sbv = (BlockViews.SimpleBlockView)e.Block; BlockViews.ContainerBlockView cbv = coveredBlockViews[0]; sbv.RemoveFromParentContainerIfSet(); cbv.AddChild(sbv); } }; }
public void AddChild(SimpleBlockView sbv) { XamlContainer.Children.Add(sbv); /* VerticalOptions = "Start" * HorizontalOptions = "FillAndExpand"*/ sbv.ParentContainer = this; }
private Point GetScreenCoordinates(BlockViews.BlockView bv) { if (bv is BlockViews.SimpleBlockView) { BlockViews.SimpleBlockView sbv = (BlockViews.SimpleBlockView)bv; Point parentPoint = sbv.GetParentPoint(); if (parentPoint.X != -1) { MainPage.Log("ParentPointX:" + parentPoint.X + ", PArentPoint.Y : " + parentPoint.Y); return(parentPoint); } } //else, it's a container return(new Point(bv.X, bv.Y)); }
public void RemoveChild(SimpleBlockView sbv) { XamlContainer.Children.Remove(sbv); sbv.ParentContainer = null; // sbv.Parent = al; }