/// <summary> /// Intializes the arrangement of the children /// </summary> private void InitializeArrange() { foreach (UIElement child in FluidElements) { // Get the child's index in the FluidElements int index = FluidElements.IndexOf(child); // Get the initial location of the child Point pos = layoutManager.GetInitialLocationOfChild(index); // Initialize the appropriate Render Transform for the child child.RenderTransform = layoutManager.CreateTransform(pos.X, pos.Y, NORMAL_SCALE, NORMAL_SCALE); } }
/// <summary> /// Moves the dragElement to the new Index /// </summary> /// <param name="newIndex">Index of the new location</param> /// <returns>True-if dragElement was moved otherwise False</returns> private bool UpdateDragElementIndex(int newIndex) { // Check if the dragElement is being moved to its current place // If yes, then no need to proceed further. (Improves efficiency!) int dragCellIndex = FluidElements.IndexOf(dragElement); if (dragCellIndex == newIndex) { return(false); } FluidElements.RemoveAt(dragCellIndex); FluidElements.Insert(newIndex, dragElement); return(true); }