Esempio n. 1
0
 private void OnSearchListSelected(IEnumerable <object> os)
 {
     if (os.FirstOrDefault() is ItemNew item)
     {
         SelectListItem(items.IndexOf(item));
     }
     else if (os.FirstOrDefault() is ItemTemplate template)
     {
         SelectListTemplate(templates.IndexOf(template));
     }
     searchDropdown.SetSelectionWithoutNotify(null);
     searchField.value = null;
 }
Esempio n. 2
0
        private void InsertRange(int index)
        {
            var newSelection    = new List <int>();
            var selectedItems   = m_ListView.selectedItems.ToArray();
            var selectedIndices = m_ListView.selectedIndices.ToArray();

            for (var i = 0; i < selectedItems.Length; i++)
            {
                var item = selectedItems[i];
                m_ListView.itemsSource.Insert(index, item);
                onItemMoved?.Invoke(new ItemMoveArgs <object>
                {
                    item          = item,
                    newIndex      = index,
                    previousIndex = selectedIndices[i]
                });

                newSelection.Add(index);
                index++;
            }

            m_ListView.SetSelectionWithoutNotify(newSelection);
        }