967 references to Items
Accessibility_Core_App (5)
CommonControl1.cs (3)
46listView1.Groups[0].Items.Add(listView1.Items[0]); 47listView1.Groups[1].Items.AddRange(listView1.Items[1], listView1.Items[2]);
CommonControl1.Designer.cs (1)
382this.listView1.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
DataBindingExample.cs (1)
104listView1.Items.Add(item);
System.Windows.Forms (121)
System\Windows\Forms\Controls\ListView\ListView.CheckedIndexCollection.cs (6)
37foreach (ListViewItem item in _owner.Items) 55for (int i = 0; i < _owner.Items.Count && index < indices.Length; ++i) 57if (_owner.Items[i].Checked) 77int cnt = _owner.Items.Count; 81ListViewItem item = _owner.Items[i]; 145if (_owner.Items[checkedIndex].Checked)
System\Windows\Forms\Controls\ListView\ListView.CheckedListViewItemCollection.cs (4)
50for (int i = 0; i < _owner.Items.Count && index < items.Length; ++i) 52if (_owner.Items[i].Checked) 54items[index++] = _owner.Items[i]; 75return _owner.Items[itemIndex];
System\Windows\Forms\Controls\ListView\ListView.cs (84)
28[DefaultProperty(nameof(Items))] 816return Items[displayIndex]; 1719return Items.Count > 0 ? Items[0] : null; 1723return _topIndex >= 0 && _topIndex < Items.Count ? Items[_topIndex] : null; 1755if ((topItem is null) && (_topIndex == Items.Count)) 1891ListViewItem lvItem = Items[topIndex]; 1915if (value && Items.Count > 0) 2452Items.Clear(); 2479&& Items.Count > 0) 2505Items.Count > 0) 2522for (int i = 0; i < Items.Count; i++) 2524if (Items[i].ImageIndexer.ActualIndex > -1) 2641Items[(int)nmcd->nmcd.dwItemSpec], 2711if (nmcd->iSubItem < Items[itemIndex].SubItems.Count) 2717if (nmcd->iSubItem == 0 && Items[itemIndex].SubItems.Count > 1) 2731Items[itemIndex], 2732Items[itemIndex].SubItems[nmcd->iSubItem], 2753ListViewItem item = Items[(int)nmcd->nmcd.dwItemSpec]; 3081Items.Clear(); 3185ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, Items.Count); 3193public ListViewItem? FindItemWithText(string text) => Items.Count == 0 3203ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(startIndex, Items.Count); 3269if (Items.Count == 0) 3285return sviEvent.Index != -1 ? Items[sviEvent.Index] : null; 3316return Items[index]; 3322for (int i = startIndex; i < Items.Count; i++) 3324ListViewItem listViewItem = Items[i]; 3486li = Items[displayIndex]; 3575ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, Items.Count); 3604if (index < 0 || index >= Items.Count) 3640ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(itemIndex, Items.Count); 3645ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(subItemIndex, Items[itemIndex].SubItems.Count); 3719ListViewItem? item = (iItem == -1) ? null : Items[iItem]; 3945for (int i = 0; i < Items.Count; i++) 3947ListViewItem item = Items[i]; 3959for (int i = 0; i < Items.Count; i++) 3961ListViewItem item = Items[i]; 3997if (IsHandleCreated && Items.Count == 0 && View == View.SmallIcon && Application.ComCtlSupportsVisualStyles) 4118Debug.Assert(Items.Contains(li), "Make sure ListView.Items contains this item before adding the native LVITEM. Otherwise, custom-drawing may break."); 4310foreach (ListViewItem item in Items) 4366if (Items.Count > 0) 4650for (int i = 0; i < Items.Count; i++) 4652if (Items[i].Checked) 4654UpdateSavedCheckedItems(Items[i], true /*addItem*/); 4666int count = Items.Count; 4669Items[i].UpdateStateFromListView(i, true); 4686ListViewItemCollection tempItems = Items; 4708if (ShowItemToolTips && Items.Count > 0 && (FocusedItem ?? Items[0]) is ListViewItem focusedItem) 4855ListViewItem firstSelectedItem = Items[SelectedIndices[0]]; 4924int subItemCount = Items[i].SubItems.Count; 4927SetItemText(i, j, Items[i].SubItems[j].Text, ref item); 4982int maxSize = VirtualMode ? VirtualListSize : Items.Count; 4999Rectangle rectInvalid = Items[startIndex].Bounds; 5002rectInvalid = Rectangle.Union(rectInvalid, Items[index].Bounds); 5007rectInvalid = Rectangle.Union(rectInvalid, Items[startIndex - 1].Bounds); 5016if (endIndex < Items.Count - 1) 5018rectInvalid = Rectangle.Union(rectInvalid, Items[endIndex + 1].Bounds); 5048for (int i = 0; i < Items.Count; i++) 5050Items.GetItemByIndex(i)?.ReleaseUiaProvider(); 5501if (itemIndex < 0 || itemIndex >= Items.Count) 5570else if (Items is not null) 5572s += $", Items.Count: {Items.Count}"; 5573if (Items.Count > 0 && !VirtualMode) 5575string z = (Items[0] is null) ? "null" : Items[0].ToString(); 5834ListViewItem clickedItem = Items[displayIndex]; 5875ListViewItem clickedItem = Items[displayIndex]; 6336foreach (ListViewItem listViewItem in Items) 6488Items[dispInfo->item.iItem].Text = text; 6506ListViewItem item = Items[nmlv->iItem]; 6521ListViewItem item = Items[nmlv->iItem]; 6562ItemCheckedEventArgs e = new(Items[nmlv->iItem]); 6574if (indexItem >= 0 && indexItem < Items.Count) 6578ListViewItem item = Items[indexItem]; 6616if (Items.Count > 0) 6618ListViewItemSelectionChangedEventArgs lvisce = new(Items[nmlv->iItem], 6626if (Items.Count == 0 || Items[^1] is not null) 6814ListViewItem lvi = Items[infoTip->iItem]; 7056if (FocusedItem is null && Items.Count > 0) 7058Items[0].Focused = true;
System\Windows\Forms\Controls\ListView\ListView.ListViewAccessibleObject.cs (9)
51foreach (ListViewItem? item in owningListView.Items) 68=> this.TryGetOwnerAs(out ListView? owningListView) ? owningListView.Items.Count : base.RowCount; 103return index < owningListView.Items.Count ? owningListView.Items[index].AccessibilityObject : null; 113int count = owningListView.GroupsDisplayed ? GetVisibleGroups().Count : owningListView.Items.Count; 128return index < owningListView.Items.Count ? index : InvalidIndex; 219return owningListView.Items.Count == 0 ? null : owningListView.Items[^1].AccessibilityObject; 252selectedItemProviders[i] = owningListView.Items[owningListView.SelectedIndices[i]].AccessibilityObject;
System\Windows\Forms\Controls\ListView\ListView.ListViewNativeItemCollection.cs (4)
225int count = _owner.Items.Count; 234ListViewItem item = _owner.Items[i]; 281int count = _owner.Items.Count; 285ListViewItem item = _owner.Items[i];
System\Windows\Forms\Controls\ListView\ListView.SelectedIndexCollection.cs (6)
170if (selectedIndex < 0 || selectedIndex >= _owner.Items.Count) 175return _owner.Items[selectedIndex].Selected; 274ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(itemIndex, _owner.Items.Count); 276_owner.Items[itemIndex].Selected = true; 329ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(itemIndex, _owner.Items.Count); 331_owner.Items[itemIndex].Selected = false;
System\Windows\Forms\Controls\ListView\ListView.SelectedListViewItemCollection.cs (2)
49lvitems[i] = _owner.Items[fidx]; 139return _owner.Items[fidx];
System\Windows\Forms\Controls\ListView\ListViewGroup.ListViewGroupAccessibleObject.cs (1)
203foreach (ListViewItem? listViewItem in _owningListView.Items)
System\Windows\Forms\Controls\ListView\ListViewItem.cs (1)
1181public virtual void Remove() => _listView?.Items.Remove(this);
System\Windows\Forms\Controls\ListView\ListViewItem.IKeyboardToolTip.cs (4)
50neighboringRectangles.Add(_listView.Items[Index - 1].AccessibilityObject.Bounds); 53if (Index < _listView.Items.Count - 1) 55neighboringRectangles.Add(_listView.Items[Index + 1].AccessibilityObject.Bounds); 89ListViewItem item = _listView.Items[index];
System.Windows.Forms.Design (11)
System\Windows\Forms\Design\ListViewActionList.cs (1)
22EditorServiceContext.EditValue(_designer, Component!, nameof(ListView.Items));
System\Windows\Forms\Design\MaskDesignerDialog.cs (8)
463if (maskDexIndex < 0 || _listViewCannedMasks.Items.Count <= maskDexIndex) 468_listViewCannedMasks.Items[maskDexIndex].Selected = true; 469_listViewCannedMasks.FocusedItem = _listViewCannedMasks.Items[maskDexIndex]; 505_listViewCannedMasks.Items.Clear(); 520_listViewCannedMasks.Items.Add(new ListViewItem([maskDescriptor.Name!, sample, validatingType])); 525_listViewCannedMasks.Items.Add(new ListViewItem([_customMaskDescriptor.Name, "", nullEntry])); 601if (_listViewCannedMasks.FocusedItem is not null || _listViewCannedMasks.Items.Count <= 0) 606_listViewCannedMasks.Items[0].Focused = true;
System\Windows\Forms\Design\StyleEditorForm.cs (2)
575_columnsAndRowsListView.Items.Clear(); 600_columnsAndRowsListView.Items.Add(new ListViewItem([baseName + (i + 1).ToString(CultureInfo.InvariantCulture), sizeType, sizeValue]));
System.Windows.Forms.Tests (752)
System\Windows\Forms\AccessibleObjects\ListVIew.ListViewAccessibleObjectTests.cs (90)
86listView.Items.Add(new ListViewItem()); 93listView.Items.Add(item); 94listView.Items.Add(item2); 116listView.Items.Add(new ListViewItem()); 123listView.Items.Add(item); 124listView.Items.Add(item2); 140listView.Items.Add(new ListViewItem()); 147listView.Items.Add(item); 148listView.Items.Add(item2); 164listView.Items.Add(new ListViewItem()); 165listView.Items.Add(new ListViewItem()); 181listView.Items.Add(new ListViewItem()); 182listView.Items.Add(new ListViewItem()); 296listView.Items.Add(listViewItem1); 297listView.Items.Add(listViewItem2); 420listView.Items.Add(listViewItem1); 421listView.Items.Add(listViewItem2); 422listView.Items.Add(listViewItem3); 543listView.Items.Add(listViewItem1); 544listView.Items.Add(listViewItem2); 545listView.Items.Add(listViewItem3); 614listView.Items.Add(listViewItem1); 615listView.Items.Add(listViewItem2); 616listView.Items.Add(listViewItem3); 670listView.Items.Add(listViewItem1); 671listView.Items.Add(listViewItem2); 672listView.Items.Add(listViewItem3); 688Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].AccessibilityObject)); 689Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[1].AccessibilityObject)); 690Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[2].AccessibilityObject)); 694Assert.Equal(0, accessibleObject.GetChildIndex(listView.Items[0].AccessibilityObject)); 695Assert.Equal(1, accessibleObject.GetChildIndex(listView.Items[1].AccessibilityObject)); 696Assert.Equal(2, accessibleObject.GetChildIndex(listView.Items[2].AccessibilityObject)); 752listView.Items.Add(listViewItem1); 753listView.Items.Add(listViewItem2); 754listView.Items.Add(listViewItem3); 770Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].AccessibilityObject)); 771Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[1].AccessibilityObject)); 772Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[2].AccessibilityObject)); 776Assert.Equal(0, accessibleObject.GetChildIndex(listView.Items[0].AccessibilityObject)); 777Assert.Equal(1, accessibleObject.GetChildIndex(listView.Items[1].AccessibilityObject)); 778Assert.Equal(2, accessibleObject.GetChildIndex(listView.Items[2].AccessibilityObject)); 884listView.Items.Add(listViewItem1); 885listView.Items.Add(listViewItem2); 886listView.Items.Add(listViewItem3); 930listView.Items.Add(listItem1); 931listView.Items.Add(listItem2); 932listView.Items.Add(listItem3); 933listView.Items.Add(listItem4); 935listView.Items[0].Selected = true; 936listView.Items[1].Selected = true; 937listView.Items[3].Selected = true; 958listView.Items.Add(listItem1); 976listView.Items.Add(listItem1); 1036listView.Items[0].Selected = true; 1037listView.Items[1].Selected = true; 1038listView.Items[3].Selected = true; 1151listView.Items.Add(new ListViewItem(["Item 1", "SubItem 1"])); 1152listView.Items.Add(new ListViewItem(["Item 1", "SubItem 1"])); 1174listView.Items.Add(new ListViewItem(["Item 1", "SubItem 1"])); 1175listView.Items.Add(new ListViewItem(["Item 1", "SubItem 1"])); 1194listView.Items.Add(new ListViewItem(["Item 1", "SubItem 11", "SubItem 12"])); 1195listView.Items.Add(new ListViewItem(["Item 2", "SubItem 21", "SubItem 22"])); 1199Assert.Equal(listView.Items[0].SubItems[0].AccessibilityObject, HitTest(listView, GetSubItemLocation(0, 0))); 1200Assert.Equal(listView.Items[0].SubItems[1].AccessibilityObject, HitTest(listView, GetSubItemLocation(0, 1))); 1201Assert.Equal(listView.Items[0].SubItems[2].AccessibilityObject, HitTest(listView, GetSubItemLocation(0, 2))); 1202Assert.Equal(listView.Items[1].SubItems[0].AccessibilityObject, HitTest(listView, GetSubItemLocation(1, 0))); 1203Assert.Equal(listView.Items[1].SubItems[1].AccessibilityObject, HitTest(listView, GetSubItemLocation(1, 1))); 1204Assert.Equal(listView.Items[1].SubItems[2].AccessibilityObject, HitTest(listView, GetSubItemLocation(1, 2))); 1220listView.Items.Add(new ListViewItem(["Item 1"])); 1221listView.Items.Add(new ListViewItem(["Item 2"])); 1229((ListViewItemDetailsAccessibleObject)listView.Items[itemIndex].AccessibilityObject).GetDetailsSubItemOrFake(subItemIndex); 1320expectedValues.Add(listView.Items[0].AccessibilityObject); 1321expectedValues.Add(listView.Items[1].AccessibilityObject); 1322expectedValues.Add(listView.Items[2].AccessibilityObject); 1367: listView.Items[0].AccessibilityObject; 1371: listView.Items[3].AccessibilityObject; 1427listView.Items.Add(listItem1); 1428listView.Items.Add(listItem2); 1429listView.Items.Add(listItem3); 1430listView.Items.Add(listItem4); 1490listView.Items.Add(listViewItem1); 1491listView.Items.Add(listViewItem2); 1575listView.Items.Add(listViewItem1); 1576listView.Items.Add(listViewItem2); 1676listView.Items.Add(listViewItem1); 1677listView.Items.Add(listViewItem2); 1733listView.Items.Add(listViewItem1); 1734listView.Items.Add(listViewItem2); 1751listView.Items.AddRange(Enumerable.Range(0, 11).Select(i => new ListViewItem()).ToArray());
System\Windows\Forms\AccessibleObjects\ListViewGroup.ListViewGroupAccessibleObjectTests.cs (38)
86list.Items.Add(new ListViewItem()); 142ListViewItemCollection items = listView.Items; 212ListViewItemCollection items = listView.Items; 284list.Items.Add(listItem1); 285list.Items.Add(listItem2); 328listView.Items.Add(new ListViewItem("a", group)); 375ListViewItemCollection items = listView.Items; 470ListViewItemCollection items = listView.Items; 506ListViewItemCollection items = listView.Items; 590ListViewItemCollection items = listView.Items; 683listView.Items.Add(listViewItem); 713listView.Items.Add(new ListViewItem("Item1", lvgroup1)); 722listView.Items.Add(new ListViewItem("Item2", lvgroup2)); 747listView.Items.Add(new ListViewItem("Group Item 1", listViewGroup)); 748listView.Items.Add(new ListViewItem("Group Item 2", listViewGroup)); 800listView.Items.AddRange((ListViewItem[])[item1, item2, item3]); 891listView.Items.Add(listViewItem1); 892listView.Items.Add(listViewItem2); 976listView.Items.Add(listView.Groups[0].Items[0]); 977listView.Items.Add(listView.Groups[0].Items[3]); 1002listView.Items.RemoveAt(1); 1045listView.Items.Add(listView.Groups[0].Items[0]); 1046listView.Items.Add(listView.Groups[0].Items[3]); 1069listView.Items.RemoveAt(1); 1073listView.Items.RemoveAt(0); 1115listView.Items.Add(listView.Groups[0].Items[0]); 1116listView.Items.Add(listView.Groups[0].Items[3]); 1141listView.Items.RemoveAt(1); 1220listView.Items.Add(new ListViewItem()); 1242listView.Items.Add(listViewItem1); 1243listView.Items.Add(listViewItem2); 1270listView.Items.Add(listItem1); 1271listView.Items.Add(listItem2); 1272listView.Items.Add(listItem3); 1333listView.Items.Add(item); 1408listView.Items.AddRange((ListViewItem[])[listViewVisibleItem1, listViewVisibleItem2]); 1458listView.Items.Add(listViewItem1); 1459listView.Items.Add(listViewItem2);
System\Windows\Forms\AccessibleObjects\ListViewItem.ListViewItemAccessibleObjectTests.cs (202)
18list.Items.Add(listItem); 37list.Items.Add(listItem); 80listView.Items.Add(listViewItem2); 95list.Items.Add(listItem); 145AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 146AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 147AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 148AccessibleObject accessibleObject4 = listView.Items[3].AccessibilityObject; 161? listView.Items[index].Group is not null 196AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 197AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 198AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 199AccessibleObject accessibleObject4 = listView.Items[3].AccessibilityObject; 225AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 226AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 227AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 228AccessibleObject accessibleObject4 = listView.Items[3].AccessibilityObject; 243AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 244AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 245AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 246AccessibleObject accessibleObject4 = listView.Items[3].AccessibilityObject; 272AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 273AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 274AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 275AccessibleObject accessibleObject4 = listView.Items[3].AccessibilityObject; 307AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 308AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 309AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 310AccessibleObject accessibleObject4 = listView.Items[3].AccessibilityObject; 328AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 329AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 330AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 331AccessibleObject accessibleObject4 = listView.Items[3].AccessibilityObject; 349AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 350AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 351AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 352AccessibleObject accessibleObject4 = listView.Items[3].AccessibilityObject; 354Assert.Equal(listView.Items[0].SubItems[0].AccessibilityObject, accessibleObject1.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild)); 355Assert.Equal(listView.Items[1].SubItems[0].AccessibilityObject, accessibleObject2.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild)); 356Assert.Equal(listView.Items[2].SubItems[0].AccessibilityObject, accessibleObject3.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild)); 357Assert.Equal(listView.Items[3].SubItems[0].AccessibilityObject, accessibleObject4.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild)); 381AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 382AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 384Assert.Equal(listView.Items[0].SubItems[0].AccessibilityObject, accessibleObject1.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild)); 385Assert.Equal(listView.Items[1].SubItems[0].AccessibilityObject, accessibleObject2.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild)); 395AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 396AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 397AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 398AccessibleObject accessibleObject4 = listView.Items[3].AccessibilityObject; 416AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 417AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 418AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 419AccessibleObject accessibleObject4 = listView.Items[3].AccessibilityObject; 434AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 435AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 437Assert.Equal(listView.Items[0].SubItems[2].AccessibilityObject, accessibleObject1.FragmentNavigate(NavigateDirection.NavigateDirection_LastChild)); 438Assert.Equal(listView.Items[1].SubItems[2].AccessibilityObject, accessibleObject2.FragmentNavigate(NavigateDirection.NavigateDirection_LastChild)); 448AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 449AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 455Assert.NotEqual(listView.Items[0].SubItems[0].AccessibilityObject, lastChild1); 456Assert.NotEqual(listView.Items[1].SubItems[0].AccessibilityObject, lastChild2); 466AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 467AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 471Assert.Equal(listView.Items[0].SubItems[0].AccessibilityObject, lastChild1); 472Assert.Equal(listView.Items[1].SubItems[0].AccessibilityObject, lastChild2); 482AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 483AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 489Assert.Single(listView.Items[0].SubItems); 490Assert.Single(listView.Items[1].SubItems); 492listView.Items[0].SubItems.Add(new ListViewSubItem() { Text = $"SubItem 0" }); 493listView.Items[1].SubItems.Add(new ListViewSubItem() { Text = $"SubItem 0" }); 498Assert.Equal(listView.Items[0].SubItems[1].AccessibilityObject, lastChild1); 499Assert.Equal(listView.Items[1].SubItems[1].AccessibilityObject, lastChild2); 500Assert.Equal(2, listView.Items[0].SubItems.Count); 501Assert.Equal(2, listView.Items[1].SubItems.Count); 511AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 512AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 516Assert.Equal(listView.Items[0].SubItems[1].AccessibilityObject, lastChild1); 517Assert.Equal(listView.Items[1].SubItems[1].AccessibilityObject, lastChild2); 518Assert.Equal(2, listView.Items[0].SubItems.Count); 519Assert.Equal(2, listView.Items[1].SubItems.Count); 521listView.Items[0].SubItems.RemoveAt(1); 522listView.Items[1].SubItems.RemoveAt(1); 529Assert.Single(listView.Items[0].SubItems); 530Assert.Single(listView.Items[1].SubItems); 656listView.Items.Add(listItem1); 657listView.Items[0].Selected = selected; 658AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 719listView.Items[0].Selected = true; 722AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 755Assert.NotEqual(Rectangle.Empty, listView.Items[0].AccessibilityObject.Bounds); 758Assert.Equal(Rectangle.Empty, listView.Items[1].AccessibilityObject.Bounds); 762Assert.NotEqual(Rectangle.Empty, listView.Items[1].AccessibilityObject.Bounds); 765Assert.NotEqual(Rectangle.Empty, listView.Items[2].AccessibilityObject.Bounds); 776Assert.Equal(Rectangle.Empty, listView.Items[0].AccessibilityObject.Bounds); 777Assert.Equal(Rectangle.Empty, listView.Items[1].AccessibilityObject.Bounds); 778Assert.Equal(Rectangle.Empty, listView.Items[2].AccessibilityObject.Bounds); 800listView.Items.Add(listViewItem); 989listView.Items.Add(listView.Groups[0].Items[0]); 990listView.Items.Add(listView.Groups[0].Items[3]); 1019listView.Items.RemoveAt(1); 1041Assert.Equal(expectedCount, listView.Items[0].AccessibilityObject.GetChildCount()); 1042Assert.Equal(expectedCount, listView.Items[1].AccessibilityObject.GetChildCount()); 1051AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 1052AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 1058Assert.Equal(listView.Items[0].SubItems[0].AccessibilityObject, accessibleObject1.GetChild(0)); 1059Assert.Equal(listView.Items[0].SubItems[1].AccessibilityObject, accessibleObject1.GetChild(1)); 1064Assert.Equal(listView.Items[1].SubItems[0].AccessibilityObject, accessibleObject2.GetChild(0)); 1065Assert.Equal(listView.Items[1].SubItems[1].AccessibilityObject, accessibleObject2.GetChild(1)); 1091AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 1092AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 1098Assert.Equal(listView.Items[0].SubItems[0].AccessibilityObject, accessibleObject1.GetChild(0)); 1099Assert.Equal(listView.Items[0].SubItems[1].AccessibilityObject, accessibleObject1.GetChild(1)); 1100Assert.Equal(listView.Items[0].SubItems[2].AccessibilityObject, accessibleObject1.GetChild(2)); 1102Assert.Equal(listView.Items[1].SubItems[0].AccessibilityObject, accessibleObject2.GetChild(0)); 1103Assert.Equal(listView.Items[1].SubItems[1].AccessibilityObject, accessibleObject2.GetChild(1)); 1104Assert.Equal(listView.Items[1].SubItems[2].AccessibilityObject, accessibleObject2.GetChild(2)); 1176listView.Items.AddRange((ListViewItem[])[listItem1, listItem2]); 1238listView.Items.Add(listItem1); 1239listView.Items.Add(listItem2); 1240listView.Items.Add(listItem3); 1241listView.Items.Add(listItem4); 1263listView.Items.AddRange((ListViewItem[])[listViewVisibleItem1, listViewVisibleItem2]); 1291listView.Items.Add(new ListViewItem("Item 1")); 1292listView.Items.Add(new ListViewItem("Item 2")); 1293listView.Items.Add(new ListViewItem("Item 3")); 1298AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 1299AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 1300AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 1315listView.Items[1].Group = listView.Groups[0]; 1350listView.Items.Add(new ListViewItem("Item 1")); 1351listView.Items.Add(new ListViewItem("Item 2", group: listView.Groups[0])); 1352listView.Items.Add(new ListViewItem("Item 3")); 1357AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 1358AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 1359AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 1408listView.Items.Add(new ListViewItem("Item 1")); 1409listView.Items.Add(new ListViewItem("Item 2", group: listView.Groups[0])); 1410listView.Items.Add(new ListViewItem("Item 3")); 1415AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 1416AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 1417AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 1431listView.Groups[0].Items.Insert(0, listView.Items[0]); 1455listView.Items.Add(new ListViewItem("Item 1")); 1456listView.Items.Add(new ListViewItem("Item 2")); 1457listView.Items.Add(new ListViewItem("Item 3")); 1462AccessibleObject accessibleObject1 = listView.Items[0].AccessibilityObject; 1463AccessibleObject accessibleObject2 = listView.Items[1].AccessibilityObject; 1464AccessibleObject accessibleObject3 = listView.Items[2].AccessibilityObject; 1481listView.Items[1].Group = listView.Groups[0]; 1497listView.Groups[0].Items.Insert(0, listView.Items[0]); 1537listView.Items.Add(new ListViewItem(["Item 1", "SubItem 1", "SubItem 2"])); 1540AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 1544Assert.Equal(0, accessibleObject.GetChildIndex(listView.Items[0].SubItems[0].AccessibilityObject)); 1545Assert.Equal(1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[1].AccessibilityObject)); 1546Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[2].AccessibilityObject)); 1550Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[0].AccessibilityObject)); 1551Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[1].AccessibilityObject)); 1552Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[2].AccessibilityObject)); 1567listView.Items.Add(new ListViewItem(["Item 1", "SubItem 1", "SubItem 2"])); 1569Assert.Equal(-1, listView.Items[0].AccessibilityObject.GetChildIndex(null)); 1585listView.Items.Add(new ListViewItem(["Item 1", "SubItem 11", "SubItem 12"])); 1586listView.Items.Add(new ListViewItem(["Item 2", "SubItem 21", "SubItem 22"])); 1588Assert.Equal(-1, listView.Items[0].AccessibilityObject.GetChildIndex(listView.Items[1].SubItems[1].AccessibilityObject)); 1600listView.Items.Add(new ListViewItem(["Item 1"])); 1601ListViewItemDetailsAccessibleObject accessibleObject = (ListViewItemDetailsAccessibleObject)listView.Items[0].AccessibilityObject; 1603Assert.Equal(0, accessibleObject.GetChildIndex(listView.Items[0].SubItems[0].AccessibilityObject)); 1625listView.Items.Add(listViewItem); 1626var accessibleObject = (ListViewItemDetailsAccessibleObject)listView.Items[0].AccessibilityObject; 1628Assert.Equal(expectedFirstSubItemIndex, accessibleObject.GetChildIndex(listView.Items[0].SubItems[0].AccessibilityObject)); 1644listView.Items.Add(new ListViewItem(["Item 1", "SubItem 11", "SubItem 12"])); 1646Assert.Equal(-1, listView.Items[0].AccessibilityObject.GetChildIndex(listView.AccessibilityObject)); 1659listView.Items.Add(new ListViewItem("Test")); 1664Assert.IsType<ListViewItemDetailsAccessibleObject>(listView.Items[0].AccessibilityObject); 1667Assert.IsType<ListViewItemLargeIconAccessibleObject>(listView.Items[0].AccessibilityObject); 1670Assert.IsType<ListViewItemListAccessibleObject>(listView.Items[0].AccessibilityObject); 1673Assert.IsType<ListViewItemSmallIconAccessibleObject>(listView.Items[0].AccessibilityObject); 1676Assert.IsType<ListViewItemTileAccessibleObject>(listView.Items[0].AccessibilityObject); 1700listView.Items.Add(new ListViewItem("Test")); 1712Assert.IsType<ListViewItemDetailsAccessibleObject>(listView.Items[0].AccessibilityObject); 1715Assert.IsType<ListViewItemLargeIconAccessibleObject>(listView.Items[0].AccessibilityObject); 1718Assert.IsType<ListViewItemListAccessibleObject>(listView.Items[0].AccessibilityObject); 1721Assert.IsType<ListViewItemSmallIconAccessibleObject>(listView.Items[0].AccessibilityObject); 1724Assert.IsType<ListViewItemTileAccessibleObject>(listView.Items[0].AccessibilityObject); 1754listView.Items.Add(new ListViewItem(["1", "2"])); 1755AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 1787listView.Items.Add(new ListViewItem(["1"])); 1788AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 1833ListViewItemBaseAccessibleObject accessibleObject = (ListViewItemBaseAccessibleObject)listView.Items[0].AccessibilityObject; 1835bool expected = listView.GroupsDisplayed && listView.Items[0].Group?.CollapsedState == ListViewGroupCollapsedState.Collapsed; 1847listView.Items.Add(item); 1861listView.Items.Add(item); 1875listView.Items.Add(item); 1878listView.Items.Clear(); 1889listView.Items.Add(item); 1892listView.Items.Remove(item); 1903listView.Items.Add(item); 1906listView.Items[0] = new ListViewItem(); 1972listView.Items.Add(listViewItem1); 1973listView.Items.Add(listViewItem2); 1974listView.Items.Add(listViewItem3);
System\Windows\Forms\AccessibleObjects\ListViewItem.ListViewItemBaseAccessibleObjectTests.cs (28)
24control.Items.Add(item); 35control.Items.Add(item); 46control.Items.Add(item); 59control.Items.Add(item); 71control.Items.Add(item); 82control.Items.Add(item); 99control.Items.Add(item); 117control.Items.Add(item); 134control.Items.Add(item); 152control.Items.Add(item); 165control.Items.AddRange((ListViewItem[])[new(), new(), new()]); 167AccessibleObject accessibleObject1 = control.Items[0].AccessibilityObject; 168AccessibleObject accessibleObject2 = control.Items[1].AccessibilityObject; 182control.Items.Add(item); 201control.Items.Add(item); 219control.Items.Add(item); 232control.Items.Add(item); 245control.Items.Add(item); 258control.Items.Add(item); 271control.Items.Add(item); 287listView.Items.Add(item); 303listView.Items.Add(item); 322listView.Items.Add(item); 340control.Items.Add(item); 351control.Items.Add(item); 364control.Items.Add(item); 377control.Items.Add(item); 394listView.Items.Add(item);
System\Windows\Forms\AccessibleObjects\ListViewItem.ListViewItemDetailsAccessibleObjectTests.cs (10)
24control.Items.Add(item); 38control.Items.Add(item); 56control.Items.Add(item); 70control.Items.Add(item); 88control.Items.Add(item); 101control.Items.Add(item); 116control.Items.Add(item); 152listView.Items.Add(listViewItem); 154var accessibleObject = (ListViewItemDetailsAccessibleObject)listView.Items[0].AccessibilityObject; 170listView1.Items.AddRange((ListViewItem[])[listViewItem1, listViewItem2]);
System\Windows\Forms\AccessibleObjects\ListViewItem.ListViewItemImageAccessibleObjectTests.cs (2)
25list.Items.Add(listViewItem); 51list.Items.Add(listViewItem);
System\Windows\Forms\AccessibleObjects\ListViewItem.ListViewItemListAccessibleObjectTests.cs (12)
29control.Items.Add(new ListViewItem()); 31Assert.Equal(Rectangle.Empty, control.Items[0].AccessibilityObject.Bounds); 40control.Items.Add(new ListViewItem()); 41AccessibleObject accessibleObject1 = control.Items[0].AccessibilityObject; 52control.Items.AddRange((ListViewItem[])[new(), new(), new()]); 55AccessibleObject accessibleObject1 = control.Items[0].AccessibilityObject; 56AccessibleObject accessibleObject2 = control.Items[1].AccessibilityObject; 57AccessibleObject accessibleObject3 = control.Items[2].AccessibilityObject; 71control.Items.AddRange((ListViewItem[])[new(), new(), new()]); 74AccessibleObject accessibleObject1 = control.Items[0].AccessibilityObject; 75AccessibleObject accessibleObject2 = control.Items[1].AccessibilityObject; 76AccessibleObject accessibleObject3 = control.Items[2].AccessibilityObject;
System\Windows\Forms\AccessibleObjects\ListViewItem.ListViewItemWithImageAccessibleObjectTests.cs (12)
17control.Items.Add(new ListViewItem()); 19AccessibleObject listViewItemAccessibleObject = control.Items[0].AccessibilityObject; 45control.Items.Add(listViewItem); 47AccessibleObject listViewItemAccessibleObject = control.Items[0].AccessibilityObject; 63control.Items.Add(new ListViewItem()); 65AccessibleObject listViewItemAccessibleObject = control.Items[0].AccessibilityObject; 85control.Items.Add(listViewItem); 87AccessibleObject listViewItemAccessibleObject = control.Items[0].AccessibilityObject; 99control.Items.Add(new ListViewItem()); 102AccessibleObject listViewItemAccessibleObject = control.Items[0].AccessibilityObject; 122control.Items.Add(listViewItem); 125AccessibleObject listViewItemAccessibleObject = control.Items[0].AccessibilityObject;
System\Windows\Forms\AccessibleObjects\ListViewItem.ListViewSubItem.ListViewSubItemAccessibleObjectTests.cs (72)
35list.Items.Add(listViewItem1); 72list.Items.Add(listViewItem1); 104list.Items.Add(new ListViewItem(["Test 1", "Test 2"])); 106AccessibleObject accessibleObject = list.Items[0].SubItems[1].AccessibilityObject; 140ListViewItem listViewItem = listView.Items[0]; 141ListViewItem listViewItemInGroup = listView.Items[1]; 187ListViewItem listViewItem = listView.Items[0]; 188ListViewItem listViewItemInGroup = listView.Items[1]; 217ListViewItem listViewItem = listView.Items[0]; 218ListViewItem listViewItemInGroup = listView.Items[1]; 247ListViewItem listViewItem = listView.Items[0]; 248ListViewItem listViewItemInGroup = listView.Items[1]; 288ListViewItem listViewItem = listView.Items[0]; 289ListViewItem listViewItemInGroup = listView.Items[1]; 324ListViewItem listViewItem = listView.Items[0]; 325ListViewItem listViewItemInGroup = listView.Items[1]; 357ListViewItem listViewItem = listView.Items[0]; 358ListViewItem listViewItemInGroup = listView.Items[1]; 383ListViewItem listViewItem = listView.Items[0]; 384ListViewItem listViewItemInGroup = listView.Items[1]; 409ListViewItem listViewItem = listView.Items[0]; 410ListViewItem listViewItemInGroup = listView.Items[1]; 428ListViewItem listViewItem = listView.Items[0]; 429ListViewItem listViewItemInGroup = listView.Items[1]; 462ListViewItem listViewItem = listView.Items[0]; 463ListViewItem listViewItemInGroup = listView.Items[1]; 485ListViewItem listViewItem = listView.Items[0]; 486ListViewItem listViewItemInGroup = listView.Items[1]; 508ListViewItem listViewItem = listView.Items[0]; 509ListViewItem listViewItemInGroup = listView.Items[1]; 531ListViewItem listViewItem = listView.Items[0]; 532ListViewItem listViewItemInGroup = listView.Items[1]; 554ListViewItem listViewItem = listView.Items[0]; 555ListViewItem listViewItemInGroup = listView.Items[1]; 575Assert.Same(listView.Items[0].SubItems[0].AccessibilityObject, previousSubItemAccObj1); 592ListViewItem listViewItem = listView.Items[0]; 593ListViewItem listViewItemInGroup = listView.Items[1]; 595AccessibleObject subItemAccObj = listView.Items[0].SubItems[0].AccessibilityObject; 647list.Items.Add(listViewItem1); 694list.Items.Add(listViewItem1); 735list.Items.Add(listViewItem1); 771list.Items.Add(listViewItem1); 840listView.Items.AddRange((ListViewItem[])[listItem1, listItem2]); 878listView.Items.Add(new ListViewItem("Test item 11")); 879listView.Items[0].SubItems.Add("Test item 12"); 881var itemAccessibleObject = listView.Items[0].AccessibilityObject; 882var subItemAccessibleObject = listView.Items[0].SubItems[0].AccessibilityObject; 900listView.Items.Add(new ListViewItem("Test item 11")); 901listView.Items[0].SubItems.Add("Test item 12"); 903var itemAccessibleObject = listView.Items[0].AccessibilityObject; 904var subItemAccessibleObject = listView.Items[0].SubItems[0].AccessibilityObject; 915listView.Items.Add(listViewItem); 928listView.Items.Add(listViewItem); 943listView.Items.Add(listViewItem); 972listView.Items.Add(listViewItem); 1007control.Items[0].ImageIndex = 0; 1017var subItemAccessibleObject = (ListViewSubItemAccessibleObject)control.Items[0].SubItems[i].AccessibilityObject; 1041var subItemAccessibleObject = (ListViewSubItemAccessibleObject)control.Items[0].SubItems[1].AccessibilityObject; 1053listview.Items.Add(listViewItem); 1065listView.Items.Add(listViewItem); 1081listView.Items.Add(listViewItem); 1097listView.Items.Add(listViewItem); 1100listView.Items.RemoveAt(0); 1113listView.Items.Add(listViewItem); 1116listView.Items[0].SubItems.Remove(listViewSubItem); 1129listView.Items.Add(listViewItem); 1132listView.Items[0].SubItems.Clear(); 1145listView.Items.Add(listViewItem); 1148listView.Items[0] = new ListViewItem(); 1161listView.Items.Add(listViewItem); 1164int subItemIndex = listView.Items[0].SubItems.IndexOf(listViewSubItem); 1165listView.Items[0].SubItems[subItemIndex] = new ListViewItem.ListViewSubItem();
System\Windows\Forms\AccessibleObjects\ListViewLabelEditAccessibleObjectTests.cs (2)
116Assert.Equal(listView.Items[0].Text, accessibilityObject.Name); 166listView.Items.Add(item);
System\Windows\Forms\ControlTests.cs (1)
1054listView1.Items.AddRange((ListViewItem[])[new("Foo"), new("Foo"), new("Foo")]);
System\Windows\Forms\DrawListViewItemEventArgsTests.cs (3)
86listView.Items.Add(listViewItem); 93listView.Items.Add(subItemsItem); 101fullRowSelectListView.Items.Add(fullRowSelectListViewItem);
System\Windows\Forms\ListView.ListViewItemCollectionTests.cs (3)
41ListView.ListViewItemCollection collection = listView.Items; 83var collection = listView.Items; 97var collection = listView.Items;
System\Windows\Forms\ListViewGroupCollectionTests.cs (9)
84listView.Items.Add(item); 105listView.Items.Add(item); 162otherListView.Items.Add(item); 413listView.Items.Add(item); 432listView.Items.Add(item); 493otherListView.Items.Add(item); 774listView.Items.Add(item); 793listView.Items.Add(item); 849otherListView.Items.Add(item);
System\Windows\Forms\ListViewGroupConverterTests.cs (9)
34listView.Items.Add(item1); 41listViewWithGroups.Items.Add(item2); 75listView.Items.Add(item); 93listView.Items.Add(item1); 99listViewWithGroups.Items.Add(item2); 147listView.Items.Add(item1); 154listViewWithGroups.Items.Add(item2); 263listView.Items.Add(item1); 270listViewWithGroups.Items.Add(item2);
System\Windows\Forms\ListViewGroupTests.cs (2)
1434listView.Items.Add(listViewItem); 1449listView.Items.Add(listViewItem);
System\Windows\Forms\ListViewItem.IKeyboardToolTipTests.cs (81)
127listView.Items.Add(listViewItem); 246IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[0]).GetNeighboringToolsRectangles(); 248Assert.Contains(GetNativeScreenRectangle(listView.Items[1]), neighboringToolsRectangles); 249Assert.Contains(GetNativeScreenRectangle(listView.Items[3]), neighboringToolsRectangles); 264IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[1]).GetNeighboringToolsRectangles(); 266Assert.Contains(GetNativeScreenRectangle(listView.Items[0]), neighboringToolsRectangles); 267Assert.Contains(GetNativeScreenRectangle(listView.Items[2]), neighboringToolsRectangles); 268Assert.Contains(GetNativeScreenRectangle(listView.Items[4]), neighboringToolsRectangles); 283IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[2]).GetNeighboringToolsRectangles(); 285Assert.Contains(GetNativeScreenRectangle(listView.Items[1]), neighboringToolsRectangles); 286Assert.Contains(GetNativeScreenRectangle(listView.Items[5]), neighboringToolsRectangles); 301IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[3]).GetNeighboringToolsRectangles(); 303Assert.Contains(GetNativeScreenRectangle(listView.Items[0]), neighboringToolsRectangles); 304Assert.Contains(GetNativeScreenRectangle(listView.Items[4]), neighboringToolsRectangles); 305Assert.Contains(GetNativeScreenRectangle(listView.Items[6]), neighboringToolsRectangles); 320IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[4]).GetNeighboringToolsRectangles(); 322Assert.Contains(GetNativeScreenRectangle(listView.Items[1]), neighboringToolsRectangles); 323Assert.Contains(GetNativeScreenRectangle(listView.Items[3]), neighboringToolsRectangles); 324Assert.Contains(GetNativeScreenRectangle(listView.Items[5]), neighboringToolsRectangles); 325Assert.Contains(GetNativeScreenRectangle(listView.Items[7]), neighboringToolsRectangles); 340IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[5]).GetNeighboringToolsRectangles(); 342Assert.Contains(GetNativeScreenRectangle(listView.Items[2]), neighboringToolsRectangles); 343Assert.Contains(GetNativeScreenRectangle(listView.Items[4]), neighboringToolsRectangles); 344Assert.Contains(GetNativeScreenRectangle(listView.Items[8]), neighboringToolsRectangles); 359IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[6]).GetNeighboringToolsRectangles(); 361Assert.Contains(GetNativeScreenRectangle(listView.Items[3]), neighboringToolsRectangles); 362Assert.Contains(GetNativeScreenRectangle(listView.Items[7]), neighboringToolsRectangles); 377IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[7]).GetNeighboringToolsRectangles(); 379Assert.Contains(GetNativeScreenRectangle(listView.Items[6]), neighboringToolsRectangles); 380Assert.Contains(GetNativeScreenRectangle(listView.Items[8]), neighboringToolsRectangles); 381Assert.Contains(GetNativeScreenRectangle(listView.Items[4]), neighboringToolsRectangles); 396IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[8]).GetNeighboringToolsRectangles(); 398Assert.Contains(GetNativeScreenRectangle(listView.Items[5]), neighboringToolsRectangles); 399Assert.Contains(GetNativeScreenRectangle(listView.Items[7]), neighboringToolsRectangles); 415IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[0]).GetNeighboringToolsRectangles(); 417Assert.Contains(GetNativeScreenRectangle(listView.Items[1]), neighboringToolsRectangles); 418Assert.Contains(GetNativeScreenRectangle(listView.Items[3]), neighboringToolsRectangles); 434IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[1]).GetNeighboringToolsRectangles(); 437Assert.Contains(GetNativeScreenRectangle(listView.Items[0]), neighboringToolsRectangles); 438Assert.Contains(GetNativeScreenRectangle(listView.Items[2]), neighboringToolsRectangles); 439Assert.Contains(GetNativeScreenRectangle(listView.Items[4]), neighboringToolsRectangles); 455IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[2]).GetNeighboringToolsRectangles(); 458Assert.Contains(GetNativeScreenRectangle(listView.Items[1]), neighboringToolsRectangles); 459Assert.Contains(GetNativeScreenRectangle(listView.Items[5]), neighboringToolsRectangles); 475IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[3]).GetNeighboringToolsRectangles(); 478Assert.Contains(GetNativeScreenRectangle(listView.Items[0]), neighboringToolsRectangles); 479Assert.Contains(GetNativeScreenRectangle(listView.Items[4]), neighboringToolsRectangles); 480Assert.Contains(GetNativeScreenRectangle(listView.Items[6]), neighboringToolsRectangles); 496IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[4]).GetNeighboringToolsRectangles(); 499Assert.Contains(GetNativeScreenRectangle(listView.Items[1]), neighboringToolsRectangles); 500Assert.Contains(GetNativeScreenRectangle(listView.Items[3]), neighboringToolsRectangles); 501Assert.Contains(GetNativeScreenRectangle(listView.Items[5]), neighboringToolsRectangles); 502Assert.Contains(GetNativeScreenRectangle(listView.Items[7]), neighboringToolsRectangles); 518IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[5]).GetNeighboringToolsRectangles(); 521Assert.Contains(GetNativeScreenRectangle(listView.Items[2]), neighboringToolsRectangles); 522Assert.Contains(GetNativeScreenRectangle(listView.Items[4]), neighboringToolsRectangles); 523Assert.Contains(GetNativeScreenRectangle(listView.Items[8]), neighboringToolsRectangles); 539IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[6]).GetNeighboringToolsRectangles(); 542Assert.Contains(GetNativeScreenRectangle(listView.Items[3]), neighboringToolsRectangles); 543Assert.Contains(GetNativeScreenRectangle(listView.Items[7]), neighboringToolsRectangles); 559IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[7]).GetNeighboringToolsRectangles(); 561Assert.Contains(GetNativeScreenRectangle(listView.Items[6]), neighboringToolsRectangles); 562Assert.Contains(GetNativeScreenRectangle(listView.Items[8]), neighboringToolsRectangles); 563Assert.Contains(GetNativeScreenRectangle(listView.Items[4]), neighboringToolsRectangles); 579IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[8]).GetNeighboringToolsRectangles(); 581Assert.Contains(GetNativeScreenRectangle(listView.Items[5]), neighboringToolsRectangles); 582Assert.Contains(GetNativeScreenRectangle(listView.Items[7]), neighboringToolsRectangles); 595IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[0]).GetNeighboringToolsRectangles(); 598Assert.Contains(listView.Items[0].AccessibilityObject.Bounds, neighboringToolsRectangles); 599Assert.Contains(listView.Items[1].AccessibilityObject.Bounds, neighboringToolsRectangles); 612IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[1]).GetNeighboringToolsRectangles(); 615Assert.Contains(listView.Items[0].AccessibilityObject.Bounds, neighboringToolsRectangles); 616Assert.Contains(listView.Items[1].AccessibilityObject.Bounds, neighboringToolsRectangles); 617Assert.Contains(listView.Items[2].AccessibilityObject.Bounds, neighboringToolsRectangles); 630IList<Rectangle> neighboringToolsRectangles = ((IKeyboardToolTip)listView.Items[2]).GetNeighboringToolsRectangles(); 633Assert.Contains(listView.Items[1].AccessibilityObject.Bounds, neighboringToolsRectangles); 634Assert.Contains(listView.Items[2].AccessibilityObject.Bounds, neighboringToolsRectangles); 763listView.Items.Add(listViewItem); 766return listView.Items[0]; 773listView.Items.Add(i.ToString()); 800listView.Items.AddRange((ListViewItem[])[.. listViewItems]);
System\Windows\Forms\ListViewItemTests.cs (17)
863listView.Items.Add(item); 867listView.Items.Remove(item); 892listView.Items.Add(item); 920listView.Items.Add(item); 924listView.Items.Remove(item); 950listView.Items.Add(item); 970listView.Items.Add(item); 974listView.Items.Remove(item); 1004listView.Items.Add(item); 1019listView.Items.Add(item); 1035listView.Items.Add(item); 1037Assert.Empty(listView.Items); 1084listView.Items.Add(item); 1094listView.Items.Add(item); 1098listView.Items.RemoveAt(0); 1108listView.Items.Add(item); 1112listView.Items.Clear();
System\Windows\Forms\ListViewSubItemTests.cs (13)
86listView.Items.Add(item); 92listView.Items.Remove(item); 122listView.Items.Add(item); 171listView.Items.Add(item); 207listView.Items.Add(item); 222listView.Items.Add(item); 228listView.Items.Remove(item); 258listView.Items.Add(item); 296listView.Items.Add(item); 335listView.Items.Add(item); 341listView.Items.Remove(item); 371listView.Items.Add(item); 422listView.Items.Add(item);
System\Windows\Forms\ListViewTests.cs (146)
99Assert.Empty(control.Items); 100Assert.Same(control.Items, control.Items); 876listView.Items.Add(item1); 877listView.Items.Add(item2); 878Assert.Equal(new ListViewItem[] { item1, item2 }, listView.Items.Cast<ListViewItem>()); 1049listView.Items.Add(item1); 1050listView.Items.Add(item2); 1051Assert.Equal(new ListViewItem[] { item1, item2 }, listView.Items.Cast<ListViewItem>()); 1246control.Items.Add(value); 1288control.Items.Add(value); 4086control.Items.Add(item1); 4087control.Items.Add(item2); 4110control.Items.Add(item1); 4111control.Items.Add(item2); 4156control.Items.Add(item); 4185control.Items.Add(item); 4224control.Items.Add(item1); 4245control.Items.Add(item1); 4332listView.Items.Add(testItem); 4340listView.Items[0].Focused = focused; 4341listView.Items[0].Selected = selected; 4403listView.Items[0].Focused = focused; 4404listView.Items[0].Selected = selected; 4433listView.Items[0].Focused = true; 4435var clone = (ListViewItem)listView.Items[0].Clone(); 4481control.Items.Add(new ListViewItem()); 4482control.Items.Add(new ListViewItem()); 4510control.Items.Add(item1); 4511control.Items.Add(item2); 4582control.Items.Add(item1); 4583control.Items.Add(item2); 4584control.Items.Add(item3); 4597Assert.True(control.Items.Count > 0); 4734listView.Items.Add(listItem); 4742listView.Items[0].Selected = true; 4811listView.Items.Add(listItem); 4823listView.Items[0].Focused = focused; 4868listView.Items.Add(listViewItem); 4885listView.Items.AddRange((ListViewItem[])[listViewItem1, listViewItem2, listViewItem3]); 4900listView.Items.Insert(0, listViewItem); 4914listView.Items.Add(listViewItem); 4918listView.Items.Remove(listViewItem); 4931listView.Items.Add(listViewItem); 4963listView.Items.Add(listViewItem); 5034listView.Items.AddRange(listItems); 5090listView.Items.AddRange(listItems); 5150listView.Items.Add(new ListViewItem("Test")); 5175listView.Items.Add(new ListViewItem("Test")); 5200listView.Items.Add(new ListViewItem("Test")); 5227listView.Items.Add(new ListViewItem("Test")); 5293listView.Items.GetItemByIndex(0).Should().Be(listView.Items[0]); 5294listView.Items.GetItemByIndex(1).Should().BeNull(); 5295Action action = () => listView.Items[1].ToString(); 5345ListViewItem listViewItem = listView.Items[0]; 5439listView.Items.Add(item); 5444listView.Items[0].Selected = true; 5447Point subItemLocation = listView.Items[0].SubItems[subItemIndex].Bounds.Location + new Size(1, 1); 5478listView.Items.Add(new ListViewItem("Group Item 0")); 5480listView.Items[0].Selected = true; 5481listView.Items[0].Focused = true; 5528listView.Items.AddRange((ListViewItem[])[new("test 1"), new("test 2"), new("test 3")]); 5530listView.Items[0].Selected = true; 5532Assert.True(listView.Items[0].Selected); 5533Assert.Equal(3, listView.Items.Count); 5537listView.Items.Remove(listView.Items[1]); 5539Assert.True(listView.Items[0].Selected); 5540Assert.Equal(2, listView.Items.Count); 5543Assert.True(listView.Items[0].Selected); 5545listView.Items.Remove(listView.Items[1]); 5547Assert.True(listView.Items[0].Selected); 5548Assert.Single(listView.Items); 5551Assert.True(listView.Items[0].Selected); 5560listView.Items.AddRange((ListViewItem[])[new("test 1"), new("test 2"), new("test 3")]); 5562for (int count = listView.Items.Count; count > 1; count -= 1) 5564ListViewItem item = listView.Items[0]; 5568Assert.Equal(count, listView.Items.Count); 5573listView.Items.Remove(item); 5577Assert.Equal(count, listView.Items.Count); 5590listView.Items.AddRange((ListViewItem[])[new("test 1"), new("test 2"), new("test 3")]); 5592listView.Items[0].Checked = true; 5594Assert.True(listView.Items[0].Checked); 5595Assert.Equal(3, listView.Items.Count); 5599listView.Items.Remove(listView.Items[1]); 5601Assert.True(listView.Items[0].Checked); 5602Assert.Equal(2, listView.Items.Count); 5606listView.Items.Remove(listView.Items[1]); 5608Assert.True(listView.Items[0].Checked); 5609Assert.Single(listView.Items); 5620listView.Items.AddRange((ListViewItem[])[new("test 1"), new("test 2"), new("test 3")]); 5622for (int count = listView.Items.Count; count > 1; count -= 1) 5624ListViewItem item = listView.Items[0]; 5628Assert.Equal(count, listView.Items.Count); 5633listView.Items.Remove(item); 5637Assert.Equal(count, listView.Items.Count); 5653listView.Items.AddRange((ListViewItem[])[new("test 1", groups[0]), new("test 2", groups[1]), new("test 3", groups[2])]); 5655listView.Items[0].Selected = true; 5657Assert.True(listView.Items[0].Selected); 5658Assert.Equal(3, listView.Items.Count); 5665Assert.True(listView.Items[0].Selected); 5666Assert.Equal(3, listView.Items.Count); 5670Assert.True(listView.Items[0].Selected); 5674Assert.True(listView.Items[0].Selected); 5675Assert.Equal(3, listView.Items.Count); 5679Assert.True(listView.Items[0].Selected); 5691listView.Items.AddRange((ListViewItem[])[new("test 1", groups[0]), new("test 2", groups[1]), new("test 3", groups[2])]); 5696ListViewItem item = listView.Items[i]; 5701Assert.Equal(3, listView.Items.Count); 5711Assert.Equal(3, listView.Items.Count); 5728listView.Items.AddRange((ListViewItem[])[new("test 1", groups[0]), new("test 2", groups[1]), new("test 3", groups[2])]); 5730listView.Items[0].Checked = true; 5732Assert.True(listView.Items[0].Checked); 5733Assert.Equal(3, listView.Items.Count); 5734Assert.Equal(3, listView.Items.Count); 5740Assert.True(listView.Items[0].Checked); 5741Assert.Equal(3, listView.Items.Count); 5748Assert.True(listView.Items[0].Checked); 5749Assert.Equal(3, listView.Items.Count); 5764listView.Items.AddRange((ListViewItem[])[new("test 1", groups[0]), new("test 2", groups[1]), new("test 3", groups[2])]); 5769ListViewItem item = listView.Items[i]; 5774Assert.Equal(3, listView.Items.Count); 5784Assert.Equal(3, listView.Items.Count); 5797listView.Items.Add(new ListViewItem("Test 1")); 5798listView.Items.Add(new ListViewItem("Test 2")); 5799listView.Items[0].Focused = true; 5803listView.Items.Remove(listView.Items[0]); 5813listView.Items.Add(new ListViewItem("Test 1")); 5814listView.Items.Add(new ListViewItem("Test 2")); 5815listView.Items[0].Focused = true; 5819listView.Items.RemoveAt(0); 5829listView.Items.Add(new ListViewItem("Test 1") { Name = "Test 1" }); 5830listView.Items.Add(new ListViewItem("Test 2")); 5831listView.Items[0].Focused = true; 5835listView.Items.RemoveByKey("Test 1"); 5845listView.Items.Add(new ListViewItem("Test 1")); 5846listView.Items.Add(new ListViewItem("Test 2")); 5847listView.Items[0].Focused = true; 5851listView.Items.Clear(); 6213listView.Items.Add(listItem1); 6214listView.Items.Add(listItem2);
System.Windows.Forms.UI.IntegrationTests (68)
ListViewTests.cs (68)
32Point itemCenter = GetCenter(listView.RectangleToScreen(listView.Items[0].Bounds)); 38Assert.Equal(listView.Items[0].Checked, expected); 56listView.Items.AddRange(item1, item2, item3); 127AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 129AccessibleObject? expectedAccessibleObject = listView.Items[itemIndex].SubItems[subItemIndex].AccessibilityObject; 150AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 167AccessibleObject? accessibleObject = listView.Items[0].SubItems[1].AccessibilityObject; 194Assert.Equal(expected, listView.Items[0].AccessibilityObject.GetChildCount()); 210AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 213Assert.Equal(listView.Items[0].SubItems[1].AccessibilityObject, accessibleObject.GetChild(0)); 230AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 250AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 252Assert.Equal(expected1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[0].AccessibilityObject)); 253Assert.Equal(expected2, accessibleObject.GetChildIndex(listView.Items[0].SubItems[1].AccessibilityObject)); 267AccessibleObject? accessibleObject1 = listView.Items[0].SubItems[1].AccessibilityObject; 272Assert.Equal(listView.Items[0].SubItems[2].AccessibilityObject, accessibleObject2); 273Assert.Equal(listView.Items[0].SubItems[3].AccessibilityObject, accessibleObject3); 289AccessibleObject? expectedAccessibleItem1 = listView.Items[0].SubItems[1].AccessibilityObject; 290AccessibleObject? expectedAccessibleItem2 = listView.Items[0].SubItems[2].AccessibilityObject; 313AccessibleObject? accessibleObject = listView.Items[0].SubItems[1].AccessibilityObject; 332AccessibleObject accessibleObject = (AccessibleObject)listView.Items[0].AccessibilityObject.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild)!; 349AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 352Assert.Equal(listView.Items[0].SubItems[1].AccessibilityObject, accessibleObject.GetChild(0)); 353Assert.Equal(listView.Items[0].SubItems[2].AccessibilityObject, accessibleObject.GetChild(1)); 354Assert.Equal(listView.Items[0].SubItems[3].AccessibilityObject, accessibleObject.GetChild(2)); 369AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 372Assert.Equal(listView.Items[0].SubItems[1].AccessibilityObject, accessibleObject.GetChild(0)); 373Assert.Equal(listView.Items[0].SubItems[2].AccessibilityObject, accessibleObject.GetChild(1)); 374Assert.Equal(listView.Items[0].SubItems[3].AccessibilityObject, accessibleObject.GetChild(2)); 375Assert.Equal(listView.Items[0].SubItems[4].AccessibilityObject, accessibleObject.GetChild(3)); 376Assert.Equal(listView.Items[0].SubItems[5].AccessibilityObject, accessibleObject.GetChild(4)); 391AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 393Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[0].AccessibilityObject)); 394Assert.Equal(1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[1].AccessibilityObject)); 395Assert.Equal(2, accessibleObject.GetChildIndex(listView.Items[0].SubItems[2].AccessibilityObject)); 396Assert.Equal(3, accessibleObject.GetChildIndex(listView.Items[0].SubItems[3].AccessibilityObject)); 410AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 412Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[0].AccessibilityObject)); 413Assert.Equal(1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[1].AccessibilityObject)); 414Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[2].AccessibilityObject)); 415Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[3].AccessibilityObject)); 416Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[4].AccessibilityObject)); 429AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 431Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[0].AccessibilityObject)); 432Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[1].AccessibilityObject)); 433Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[2].AccessibilityObject)); 447AccessibleObject accessibleObject = listView.Items[0].AccessibilityObject; 449Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[0].AccessibilityObject)); 450Assert.Equal(1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[1].AccessibilityObject)); 451Assert.Equal(2, accessibleObject.GetChildIndex(listView.Items[0].SubItems[2].AccessibilityObject)); 452Assert.Equal(3, accessibleObject.GetChildIndex(listView.Items[0].SubItems[3].AccessibilityObject)); 453Assert.Equal(4, accessibleObject.GetChildIndex(listView.Items[0].SubItems[4].AccessibilityObject)); 454Assert.Equal(5, accessibleObject.GetChildIndex(listView.Items[0].SubItems[5].AccessibilityObject)); 455Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[6].AccessibilityObject)); 456Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[7].AccessibilityObject)); 457Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[8].AccessibilityObject)); 458Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[9].AccessibilityObject)); 459Assert.Equal(-1, accessibleObject.GetChildIndex(listView.Items[0].SubItems[10].AccessibilityObject)); 472Assert.Equal(listView.Items[0].SubItems[0].AccessibilityObject?.Column, -1); 473Assert.Equal(listView.Items[0].SubItems[1].AccessibilityObject?.Column, -1); 474Assert.Equal(listView.Items[0].SubItems[2].AccessibilityObject?.Column, -1); 475Assert.Equal(listView.Items[0].SubItems[2].AccessibilityObject?.Column, -1); 488foreach (ListViewItem item in listView.Items) 494Point listViewCenter = GetCenter(listView.RectangleToScreen(listView.Items[0].SubItems[1].Bounds)); 500listViewCenter = GetCenter(listView.RectangleToScreen(listView.Items[2].SubItems[1].Bounds)); 507foreach (ListViewItem item in listView.Items) 542listView.Items.AddRange(listViewItem1, listViewItem2, listViewItem3); 562listView.Items.Add(listViewItem);
TrimTestBinaryDeserialization (1)
Form1.Designer.cs (1)
47listView1.Items.AddRange(new ListViewItem[] { listViewItem1 });
WinFormsControlsTest (9)
CollectionEditors.cs (1)
34_stringList.ForEach(s => listView1.Items.Add(s));
ListViewTest.cs (7)
22listView1.Items[0].ImageIndex = 0; 23listView1.Items[1].ImageIndex = 1; 24listView1.Items[2].ImageIndex = 2; 153listView1.Items.Add(new ListViewItem 166listView1.Items.Add(new ListViewItem 193listView1.Items.Add(new ListViewItem 259listView1.Items.Add(item);
ListViewTest.Designer.cs (1)
73this.listView1.Items.AddRange(new System.Windows.Forms.ListViewItem[] {