예제 #1
0
            public void Update()
            {
                var selectedItems = GetSelectedItems(this.ListView);

                if (selectedItems != null)
                {
                    foreach (var selectedItem in selectedItems)
                    {
                        var listViewItem = this.ListView.ItemContainerGenerator.ContainerFromItem(selectedItem) as ListViewItem;
                        if (listViewItem != null)
                        {
                            if (!ListViewItemExtensions.GetIsDragging(listViewItem))
                            {
                                ListViewItemExtensions.SetIsDragging(listViewItem, true);
                            }
                        }
                        this.Items.Add(selectedItem);
                    }
                }
                for (var position = this.Items.Count - 1; position >= 0; position--)
                {
                    var draggingItem = this.Items[position];
                    if (selectedItems == null || !selectedItems.Contains(draggingItem))
                    {
                        var listViewItem = this.ListView.ItemContainerGenerator.ContainerFromItem(draggingItem) as ListViewItem;
                        if (listViewItem != null)
                        {
                            ListViewItemExtensions.SetIsDragging(listViewItem, false);
                        }
                        this.Items.RemoveAt(position);
                    }
                }
            }
예제 #2
0
 public void Clear()
 {
     foreach (var draggingItem in this.Items)
     {
         var listViewItem = this.ListView.ItemContainerGenerator.ContainerFromItem(draggingItem) as ListViewItem;
         if (listViewItem != null)
         {
             ListViewItemExtensions.SetIsDragging(listViewItem, false);
         }
     }
     this.Items.Clear();
 }