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