55 writes to SelectedItem
System.Windows.Forms (1)
System\Windows\Forms\Controls\ListBoxes\ListBox.cs (1)
2023SelectedItem = savedItems[index];
System.Windows.Forms.Design (3)
System\ComponentModel\Design\DesignerActionPanel.EditorPropertyLine.cs (1)
71listBox.SelectedItem = newItem;
System\Drawing\Design\ColorEditor.ColorUI.cs (2)
372_lbCommon.SelectedItem = value; 385_lbSystem.SelectedItem = value;
System.Windows.Forms.Tests (51)
CheckedListBoxTests.cs (2)
506checkedListBox.SelectedItem = checkedListBox.Items[0]; 548checkedListBox.SelectedItem = checkedListBox.Items[0];
System\Windows\Forms\ListBoxTests.cs (49)
2795SelectedItem = value 2804control.SelectedItem = value; 2824control.SelectedItem = "item2"; 2832control.SelectedItem = "item2"; 2840control.SelectedItem = "NoSuchItem"; 2848control.SelectedItem = "item1"; 2855control.SelectedItem = null; 2877control.SelectedItem = "item2"; 2885control.SelectedItem = "item2"; 2893control.SelectedItem = "NoSuchItem"; 2901control.SelectedItem = "item1"; 2909control.SelectedItem = null; 2935control.SelectedItem = "item2"; 2944control.SelectedItem = "item2"; 2953control.SelectedItem = "NoSuchItem"; 2962control.SelectedItem = "item1"; 2971control.SelectedItem = null; 2999control.SelectedItem = "item2"; 3010control.SelectedItem = "item2"; 3021control.SelectedItem = "NoSuchItem"; 3032control.SelectedItem = "item1"; 3042control.SelectedItem = null; 3074control.SelectedItem = "item2"; 3085control.SelectedItem = "item2"; 3096control.SelectedItem = "NoSuchItem"; 3107control.SelectedItem = "item1"; 3118control.SelectedItem = null; 3142control.SelectedItem = "item2"; 3146control.SelectedItem = "NoSuchItem"; 3150control.SelectedItem = "item1"; 3154control.SelectedItem = null; 3173control.SelectedItem = "item2"; 3180control.SelectedItem = "NoSuchItem"; 3187control.SelectedItem = "item1"; 3193control.SelectedItem = null; 3222control.SelectedItem = "item2"; 3228control.SelectedItem = "item2"; 3234control.SelectedItem = "NoSuchItem"; 3240control.SelectedItem = "item1"; 3245control.SelectedItem = null; 3251control.SelectedItem = "item2"; 3265control.SelectedItem = value; 3277AssertExtensions.Throws<ArgumentException>("value", () => control.SelectedItem = "item"); 3280control.SelectedItem = "NoSuchItem"; 3283AssertExtensions.Throws<ArgumentException>("value", () => control.SelectedItem = null); 6122listBox.SelectedItem = listBox.Items[0]; 6206listBox.SelectedItem = listBox.Items[0]; 6271listBox.SelectedItem = selectedItem; 6275listBox.SelectedItem = null;
152 references to SelectedItem
System.Windows.Forms (9)
System\Windows\Forms\Controls\ListBoxes\ListBox.cs (5)
1062if (SelectionMode != SelectionMode.None && SelectedItem is not null) 1066return GetItemText(SelectedItem) ?? string.Empty; 1070return FilterItemOnProperty(SelectedItem)?.ToString() ?? string.Empty; 1084if (SelectionMode != SelectionMode.None && value is not null && (SelectedItem is null || !value.Equals(GetItemText(SelectedItem))))
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (2)
2243EditTextBox.Text = gridEntry?.GetPropertyTextValue(DropDownListBox.SelectedItem); 2269object? value = DropDownListBox.SelectedItem;
System\Windows\Forms\MDI\MDIWindowDialog.cs (2)
34ListItem? item = (ListItem?)_itemList.SelectedItem; 68ListItem? item = (ListItem?)_itemList.SelectedItem;
System.Windows.Forms.Design (37)
System\ComponentModel\Design\CollectionEditor.CollectionEditorCollectionForm.cs (6)
818RemoveInternal((ListItem?)_listBox.SelectedItem); 864_propertiesLabel.Text = string.Format(SR.CollectionEditorProperties, GetDisplayText((ListItem?)_listBox.SelectedItem)); 1031bool editEnabled = (_listBox.SelectedItem is not null) && CollectionEditable; 1032_removeButton.Enabled = editEnabled && AllowRemoveInstance(((ListItem)_listBox.SelectedItem!).Value); 1038if (_listBox.SelectedItem is not null) 1061_propertiesLabel.Text = string.Format(SR.CollectionEditorProperties, GetDisplayText((ListItem)_listBox.SelectedItem));
System\ComponentModel\Design\DesignerActionPanel.EditorPropertyLine.cs (2)
122if (listBox.SelectedItem is not null) 124SetValue(listBox.SelectedItem);
System\Drawing\Design\ColorEditor.ColorUI.cs (1)
243if (sender is ListBox lb && lb.SelectedItem is Color selectedColor)
System\Drawing\Design\CursorEditor.CursorUI.cs (1)
53Value = SelectedItem;
System\Windows\Forms\Design\DataGridViewAddColumnDialog.cs (4)
116column.DataPropertyName = ((ListBoxItem)_dataColumns.SelectedItem!).PropertyName; 492if (_dataColumns.SelectedItem is null) 497_headerTextBox.Text = _nameTextBox.Text = ((ListBoxItem)_dataColumns.SelectedItem).PropertyName; 501SetDefaultDataGridViewColumnType(((ListBoxItem)_dataColumns.SelectedItem).PropertyType);
System\Windows\Forms\Design\DataGridViewColumnCollectionDialog.cs (13)
100ListBoxItem lbi = (ListBoxItem)_selectedColumns.SelectedItem!; 112Debug.Assert(_selectedColumns.SelectedItem == item, "we must have lost track of what item is in the property grid"); 132ListBoxItem listBoxItem = (ListBoxItem)_selectedColumns.SelectedItem; 165_propertyGrid1.SelectedObject = _selectedColumns.SelectedItem; 668ListBoxItem? item = (ListBoxItem)_selectedColumns.SelectedItem!; 810_propertyGrid1.SelectedObject = _selectedColumns.SelectedItem; 839_propertyGrid1.SelectedObject = _selectedColumns.SelectedItem; 924ListBoxItem? listBoxItem = _selectedColumns.SelectedItem as ListBoxItem; 938ListBoxItem? listBoxItem = _selectedColumns.SelectedItem as ListBoxItem; 1063_propertyGrid1.SelectedObject = _selectedColumns.SelectedItem; 1070if (_selectedColumns.SelectedItem is not null) 1072DataGridViewColumn column = ((ListBoxItem)_selectedColumns.SelectedItem).DataGridViewColumn; 1152_propertyGrid1.SelectedObject = _selectedColumns.SelectedItem;
System\Windows\Forms\Design\DataGridViewColumnTypeEditor.Picker.cs (1)
121_selectedType = _typesListBox.SelectedItem is ListBoxItem selectedItem ? selectedItem.ColumnType : null;
System\Windows\Forms\Design\FormatControl.cs (7)
35if (formatTypeListBox.SelectedItem is FormatTypeClass formatType) 60public FormatTypeClass? FormatTypeItem => formatTypeListBox.SelectedItem as FormatTypeClass; 92var customFormatType = (CustomFormatType?)formatTypeListBox.SelectedItem; 101var item = (FormatTypeClass?)formatTypeListBox.SelectedItem; 110var item = (FormatTypeClass?)formatTypeListBox.SelectedItem; 122var item = (FormatTypeClass?)formatTypeListBox.SelectedItem; 404var item = (FormatTypeClass?)formatTypeListBox.SelectedItem;
System\Windows\Forms\Design\FormatControl.DateTimeFormatType.cs (2)
26if (_owner.dateTimeFormatsListBox.SelectedItem is null) 45DateTimeFormatsListBoxItem item = (_owner.dateTimeFormatsListBox.SelectedItem as DateTimeFormatsListBoxItem)!;
System.Windows.Forms.Tests (106)
CheckedListBoxTests.cs (5)
509Assert.Equal(checkedListBox.Items[0], checkedListBox.SelectedItem); 517Assert.Equal(checkedListBox.Items[0], checkedListBox.SelectedItem); 525Assert.Equal(checkedListBox.Items[0], checkedListBox.SelectedItem); 550Assert.Equal(checkedListBox.Items[0], checkedListBox.SelectedItem); 559Assert.Null(checkedListBox.SelectedItem);
System\Windows\Forms\ListBoxTests.cs (101)
110Assert.Null(control.SelectedItem); 113Assert.Null(control.SelectedItem); 2332Assert.Null(control.SelectedItem); 2340Assert.Null(control.SelectedItem); 2360Assert.Equal("item2", control.SelectedItem); 2368Assert.Equal("item2", control.SelectedItem); 2383Assert.Null(control.SelectedItem); 2405Assert.Equal("item2", control.SelectedItem); 2413Assert.Equal("item2", control.SelectedItem); 2421Assert.Equal("item1", control.SelectedItem); 2429Assert.Null(control.SelectedItem); 2455Assert.Equal("item2", control.SelectedItem); 2464Assert.Equal("item2", control.SelectedItem); 2473Assert.Equal("item1", control.SelectedItem); 2482Assert.Null(control.SelectedItem); 2510Assert.Equal("item2", control.SelectedItem); 2521Assert.Equal("item2", control.SelectedItem); 2542Assert.Null(control.SelectedItem); 2574Assert.Equal("item2", control.SelectedItem); 2585Assert.Equal("item2", control.SelectedItem); 2596Assert.Equal("item1", control.SelectedItem); 2607Assert.Null(control.SelectedItem); 2700Assert.Equal("item2", control.SelectedItem); 2706Assert.Equal("item2", control.SelectedItem); 2766Assert.Null(control.SelectedItem); 2780Assert.Null(control.SelectedItem); 2798Assert.Null(control.SelectedItem); 2806Assert.Null(control.SelectedItem); 2826Assert.Equal("item2", control.SelectedItem); 2834Assert.Equal("item2", control.SelectedItem); 2842Assert.Equal("item2", control.SelectedItem); 2857Assert.Null(control.SelectedItem); 2879Assert.Equal("item2", control.SelectedItem); 2887Assert.Equal("item2", control.SelectedItem); 2895Assert.Equal("item2", control.SelectedItem); 2903Assert.Equal("item1", control.SelectedItem); 2911Assert.Null(control.SelectedItem); 2937Assert.Equal("item2", control.SelectedItem); 2946Assert.Equal("item2", control.SelectedItem); 2955Assert.Equal("item2", control.SelectedItem); 2964Assert.Equal("item1", control.SelectedItem); 2973Assert.Null(control.SelectedItem); 3001Assert.Equal("item2", control.SelectedItem); 3012Assert.Equal("item2", control.SelectedItem); 3023Assert.Equal("item2", control.SelectedItem); 3044Assert.Null(control.SelectedItem); 3076Assert.Equal("item2", control.SelectedItem); 3087Assert.Equal("item2", control.SelectedItem); 3098Assert.Equal("item2", control.SelectedItem); 3109Assert.Equal("item1", control.SelectedItem); 3120Assert.Null(control.SelectedItem); 3224Assert.Equal("item2", control.SelectedItem); 3230Assert.Equal("item2", control.SelectedItem); 3236Assert.Equal("item2", control.SelectedItem); 3266Assert.Null(control.SelectedItem); 3278Assert.Null(control.SelectedItem); 3281Assert.Null(control.SelectedItem); 3284Assert.Null(control.SelectedItem); 3365Assert.Null(control.SelectedItem); 3374Assert.Null(control.SelectedItem); 3403Assert.Null(control.SelectedItem); 3412Assert.Null(control.SelectedItem); 3432Assert.Equal("item2", control.SelectedItem); 3441Assert.Equal("item2", control.SelectedItem); 3450Assert.Equal("item2", control.SelectedItem); 3468Assert.Equal("item2", control.SelectedItem); 3477Assert.Equal("item2", control.SelectedItem); 3486Assert.Equal("item2", control.SelectedItem); 3510Assert.Equal("item1", control.SelectedItem); 3519Assert.Equal("item1", control.SelectedItem); 3528Assert.Equal("item1", control.SelectedItem); 3552Assert.Equal("item1", control.SelectedItem); 3561Assert.Equal("item1", control.SelectedItem); 3570Assert.Equal("item1", control.SelectedItem); 3595Assert.Null(control.SelectedItem); 3606Assert.Null(control.SelectedItem); 3657Assert.Null(control.SelectedItem); 3669Assert.Null(control.SelectedItem); 3699Assert.Equal("item2", control.SelectedItem); 3711Assert.Equal("item2", control.SelectedItem); 3723Assert.Equal("item2", control.SelectedItem); 3751Assert.Null(control.SelectedItem); 3763Assert.Null(control.SelectedItem); 3775Assert.Null(control.SelectedItem); 3809Assert.Equal("item2", control.SelectedItem); 3821Assert.Equal("item2", control.SelectedItem); 3833Assert.Equal("item2", control.SelectedItem); 3867Assert.Null(control.SelectedItem); 3879Assert.Null(control.SelectedItem); 3891Assert.Null(control.SelectedItem); 6125Assert.Equal(listBox.Items[0], listBox.SelectedItem); 6133Assert.Equal(listBox.Items[0], listBox.SelectedItem); 6141Assert.Equal(listBox.Items[0], listBox.SelectedItem); 6167Assert.Equal(listBox.Items[0], listBox.SelectedItem); 6175Assert.Equal(listBox.Items[0], listBox.SelectedItem); 6183Assert.Equal(listBox.Items[0], listBox.SelectedItem); 6208Assert.Equal(listBox.Items[0], listBox.SelectedItem); 6217Assert.Null(listBox.SelectedItem); 6244Assert.Equal(listBox.Items[0], listBox.SelectedItem); 6254Assert.Null(listBox.SelectedItem); 6278string result = listBox.GetItemText(listBox.SelectedItem);