public ItemUI addItem(ListItem data) { ItemUI taskListListBoxItem = new ItemUI(this); taskListListBoxItem.Tag = (object)data; taskListListBoxItem.setText(data.Name); itemList.Add(taskListListBoxItem); itemGrid.Children.Add((UIElement)taskListListBoxItem); itemHeight = taskListListBoxItem.Height; updateItemGridHeight(); moveItemToIdxPosition(taskListListBoxItem, indexOfItem(taskListListBoxItem)); sortZIndex(); return(taskListListBoxItem); }
public ItemUI addItem(string text) { var newListItem = currItem.Add(); ItemUI taskListListBoxItem = new ItemUI(this); taskListListBoxItem.Tag = (object)newListItem; taskListListBoxItem.setText(newListItem.Name); itemList.Add(taskListListBoxItem); itemGrid.Children.Add((UIElement)taskListListBoxItem); itemHeight = taskListListBoxItem.Height; updateItemGridHeight(); moveItemToIdxPosition(taskListListBoxItem, indexOfItem(taskListListBoxItem)); sortZIndex(); return(taskListListBoxItem); }
private void onDragCompleted(object sender, Microsoft.Phone.Controls.GestureEventArgs e) { if (disableTopLevelGesture || !isDraggingListBox) { return; } isDraggingListBox = false; if (!isAddingItemViaDragTop) { return; } if (TransformUtil.getScaleY((FrameworkElement)newItem) < 0.7) { itemList.Remove(this.newItem); itemGrid.Children.Remove((UIElement)newItem); } else { TransformUtil.setScaleY((FrameworkElement)newItem, 1.0); TransformUtil.setRotateX((FrameworkElement)newItem, 0.0); TransformUtil.setScaleX((FrameworkElement)newItem, 1.0); TransformUtil.setTranslateX((FrameworkElement)newItem, 0.0); //sortZIndex(); newItem.setText(""); newItem.text.Focus(); } updateItemGridHeight(); for (int idx = indexOfItem(newItem) + 1; idx < itemList.Count; ++idx) { TransformUtil.setTranslateY((FrameworkElement)itemList[idx], idxToPosition(idx)); } newItem = (ItemUI)null; isAddingItemViaDragTop = false; enableNativeScrolling(true); enableAllChildrenGesture(true); }