417 references to SelectionMode
System.Windows.Forms (47)
System\Windows\Forms\Controls\ListBoxes\CheckedListBox.cs (9)
188
public override
SelectionMode
SelectionMode
195
if (value is not
SelectionMode
.One and not
SelectionMode
.None)
581
Color backColor = (SelectionMode !=
SelectionMode
.None) ? e.BackColor : BackColor;
582
Color foreColor = (SelectionMode !=
SelectionMode
.None) ? e.ForeColor : ForeColor;
594
if (SelectionMode !=
SelectionMode
.None && (e.State & DrawItemState.Selected) == DrawItemState.Selected)
717
Color backColor = (SelectionMode !=
SelectionMode
.None) ? e.BackColor : BackColor;
728
Color foreColor = (SelectionMode !=
SelectionMode
.None) ? e.ForeColor : ForeColor;
777
if (e.KeyChar == ' ' && SelectionMode !=
SelectionMode
.None)
System\Windows\Forms\Controls\ListBoxes\ListBox.AccessibleObject.cs (3)
37
=> this.IsOwnerHandleCreated(out ListBox? owner) && owner.SelectionMode !=
SelectionMode
.None;
41
&& owner.SelectionMode !=
SelectionMode
.One
42
&& owner.SelectionMode !=
SelectionMode
.None;
System\Windows\Forms\Controls\ListBoxes\ListBox.cs (28)
69
private
SelectionMode
_selectionMode =
SelectionMode
.One;
71
private
SelectionMode
_cachedSelectionMode =
SelectionMode
.One;
311
case
SelectionMode
.None:
314
case
SelectionMode
.MultiSimple:
317
case
SelectionMode
.MultiExtended:
320
case
SelectionMode
.One:
810
return _selectionMode !=
SelectionMode
.None;
830
SelectionMode
current = (_selectionModeChanging) ? _cachedSelectionMode : _selectionMode;
832
if (current ==
SelectionMode
.None)
837
if (current ==
SelectionMode
.One && IsHandleCreated)
854
if (_selectionMode ==
SelectionMode
.None)
859
if (_selectionMode ==
SelectionMode
.One && value != -1)
989
[DefaultValue(
SelectionMode
.One)]
991
public virtual
SelectionMode
SelectionMode
1062
if (SelectionMode !=
SelectionMode
.None && SelectedItem is not null)
1084
if (SelectionMode !=
SelectionMode
.None && value is not null && (SelectedItem is null || !value.Equals(GetItemText(SelectedItem))))
1635
Debug.Assert(_selectionMode !=
SelectionMode
.None, "Guard against setting selection for None selection mode outside this code.");
1637
if (_selectionMode ==
SelectionMode
.One)
1665
case
SelectionMode
.One:
1674
case
SelectionMode
.MultiSimple:
1675
case
SelectionMode
.MultiExtended:
1784
if (_selectionMode !=
SelectionMode
.None)
1793
if (_selectedItems.Count > 0 && _selectionMode ==
SelectionMode
.One)
1937
if (SelectionMode !=
SelectionMode
.None && DataManager is not null)
2007
if (SelectionMode !=
SelectionMode
.None)
2149
if (_selectionMode ==
SelectionMode
.None)
System\Windows\Forms\Controls\ListBoxes\ListBox.ItemAccessibleObject.cs (2)
186
|| _owningListBox.SelectionMode ==
SelectionMode
.None
187
|| _owningListBox.SelectionMode ==
SelectionMode
.One
System\Windows\Forms\Controls\ListBoxes\ListBox.SelectedObjectCollection.cs (5)
38
SelectionMode
current = _owner._selectionModeChanging ? _owner._cachedSelectionMode : _owner._selectionMode;
41
case
SelectionMode
.None:
44
case
SelectionMode
.One:
53
case
SelectionMode
.MultiSimple:
54
case
SelectionMode
.MultiExtended:
System.Windows.Forms.Design (2)
System\ComponentModel\Design\CollectionEditor.CollectionEditorCollectionForm.cs (2)
430
_listBox.SelectionMode = (CanSelectMultipleInstances() ?
SelectionMode
.MultiExtended :
SelectionMode
.One);
System.Windows.Forms.Tests (367)
CheckedListBoxTests.cs (8)
92
[InlineData(
SelectionMode
.None)]
93
[InlineData(
SelectionMode
.One)]
94
public void CheckedListBox_SelectionModeGetSet(
SelectionMode
expected)
105
[InlineData(
SelectionMode
.MultiSimple)]
106
[InlineData(
SelectionMode
.MultiExtended)]
107
public void CheckedListBox_SelectionModeGetSetInvalidFromEnum(
SelectionMode
expected)
115
[InvalidEnumData<
SelectionMode
>]
116
public void CheckedListBox_SelectionMode_SetInvalidValue_ThrowsInvalidEnumArgumentException(
SelectionMode
value)
System\Windows\Forms\AccessibleObjects\ListBoxAccessibleObjectTests.cs (13)
160
[InlineData(
SelectionMode
.One, true)]
161
[InlineData(
SelectionMode
.None, false)]
162
[InlineData(
SelectionMode
.MultiSimple, true)]
163
[InlineData(
SelectionMode
.MultiExtended, true)]
164
public unsafe void ListBoxItemAccessibleObject_GetPropertyValue_IsSelectionRequired(
SelectionMode
mode, bool expected)
181
[InlineData(
SelectionMode
.One, false)]
182
[InlineData(
SelectionMode
.None, false)]
183
[InlineData(
SelectionMode
.MultiSimple, true)]
184
[InlineData(
SelectionMode
.MultiExtended, true)]
185
public unsafe void ListBoxItemAccessibleObject_GetPropertyValue_CanSelectMultiple(
SelectionMode
mode, bool expected)
205
listBox.SelectionMode =
SelectionMode
.MultiSimple;
314
using ListBox listBox = new() { SelectionMode = multipleSelection ?
SelectionMode
.MultiExtended :
SelectionMode
.One };
System\Windows\Forms\ListBox.ObjectCollectionTests.cs (144)
764
[InlineData(
SelectionMode
.MultiExtended)]
765
[InlineData(
SelectionMode
.MultiSimple)]
766
public void ListBoxObjectCollection_Item_SetWithMultipleSelectedItemsNotSorted_Success(
SelectionMode
selectionMode)
833
[InlineData(
SelectionMode
.MultiExtended)]
834
[InlineData(
SelectionMode
.MultiSimple)]
835
public void ListBoxObjectCollection_Item_SetWithMultipleSelectedItemsSorted_Success(
SelectionMode
selectionMode)
1046
[InlineData(
SelectionMode
.MultiExtended)]
1047
[InlineData(
SelectionMode
.MultiSimple)]
1048
public void ListBoxObjectCollection_Item_SetWithMultipleSelectedItemsNotSortedWithHandle_Success(
SelectionMode
selectionMode)
1145
[InlineData(
SelectionMode
.MultiExtended)]
1146
[InlineData(
SelectionMode
.MultiSimple)]
1147
public void ListBoxObjectCollection_Item_SetWithMultipleSelectedItemsSortedWithHandle_Success(
SelectionMode
selectionMode)
1850
[InlineData(
SelectionMode
.MultiExtended)]
1851
[InlineData(
SelectionMode
.MultiSimple)]
1852
public void ListBoxObjectCollection_Add_WithMultipleSelectedItemsNotSorted_Success(
SelectionMode
selectionMode)
1894
[InlineData(
SelectionMode
.MultiExtended)]
1895
[InlineData(
SelectionMode
.MultiSimple)]
1896
public void ListBoxObjectCollection_Add_WithMultipleSelectedItemsSorted_Success(
SelectionMode
selectionMode)
2022
[InlineData(
SelectionMode
.MultiExtended)]
2023
[InlineData(
SelectionMode
.MultiSimple)]
2024
public void ListBoxObjectCollection_Add_WithMultipleSelectedItemsNotSortedWithHandle_Succes(
SelectionMode
selectionMode)
2082
[InlineData(
SelectionMode
.MultiExtended)]
2083
[InlineData(
SelectionMode
.MultiSimple)]
2084
public void ListBoxObjectCollection_Add_WithMultipleSelectedItemsSortedWithHandle_Succes(
SelectionMode
selectionMode)
2591
[InlineData(
SelectionMode
.MultiExtended)]
2592
[InlineData(
SelectionMode
.MultiSimple)]
2593
public void ListBoxObjectCollection_AddRange_ObjectArrayWithMultipleSelectedItemsNotSorted_Success(
SelectionMode
selectionMode)
2626
[InlineData(
SelectionMode
.MultiExtended)]
2627
[InlineData(
SelectionMode
.MultiSimple)]
2628
public void ListBoxObjectCollection_AddRange_ObjectArrayWithMultipleSelectedItemsSorted_Success(
SelectionMode
selectionMode)
2744
[InlineData(
SelectionMode
.MultiExtended)]
2745
[InlineData(
SelectionMode
.MultiSimple)]
2746
public void ListBoxObjectCollection_AddRange_ObjectArrayWithMultipleSelectedItemsNotSortedWithHandle_Succes(
SelectionMode
selectionMode)
2792
[InlineData(
SelectionMode
.MultiExtended)]
2793
[InlineData(
SelectionMode
.MultiSimple)]
2794
public void ListBoxObjectCollection_AddRange_ObjectArrayWithMultipleSelectedItemsSortedWithHandle_Succes(
SelectionMode
selectionMode)
3295
[InlineData(
SelectionMode
.MultiExtended)]
3296
[InlineData(
SelectionMode
.MultiSimple)]
3297
public void ListBoxObjectCollection_AddRange_ObjectCollectionWithMultipleSelectedItemsNotSorted_Success(
SelectionMode
selectionMode)
3335
[InlineData(
SelectionMode
.MultiExtended)]
3336
[InlineData(
SelectionMode
.MultiSimple)]
3337
public void ListBoxObjectCollection_AddRange_ObjectCollectionWithMultipleSelectedItemsSorted_Success(
SelectionMode
selectionMode)
3468
[InlineData(
SelectionMode
.MultiExtended)]
3469
[InlineData(
SelectionMode
.MultiSimple)]
3470
public void ListBoxObjectCollection_AddRange_ObjectCollectionWithMultipleSelectedItemsNotSortedWithHandle_Succes(
SelectionMode
selectionMode)
3521
[InlineData(
SelectionMode
.MultiExtended)]
3522
[InlineData(
SelectionMode
.MultiSimple)]
3523
public void ListBoxObjectCollection_AddRange_ObjectCollectionWithMultipleSelectedItemsSortedWithHandle_Succes(
SelectionMode
selectionMode)
4667
[InlineData(
SelectionMode
.MultiExtended)]
4668
[InlineData(
SelectionMode
.MultiSimple)]
4669
public void ListBoxObjectCollection_Insert_WithMultipleSelectedItemsNotSorted_Success(
SelectionMode
selectionMode)
4711
[InlineData(
SelectionMode
.MultiExtended)]
4712
[InlineData(
SelectionMode
.MultiSimple)]
4713
public void ListBoxObjectCollection_Insert_WithMultipleSelectedItemsSorted_Success(
SelectionMode
selectionMode)
4837
[InlineData(
SelectionMode
.MultiExtended)]
4838
[InlineData(
SelectionMode
.MultiSimple)]
4839
public void ListBoxObjectCollection_Insert_WithMultipleSelectedItemsNotSortedWithHandle_Succes(
SelectionMode
selectionMode)
4897
[InlineData(
SelectionMode
.MultiExtended)]
4898
[InlineData(
SelectionMode
.MultiSimple)]
4899
public void ListBoxObjectCollection_Insert_WithMultipleSelectedItemsSortedWithHandle_Succes(
SelectionMode
selectionMode)
5617
[InlineData(
SelectionMode
.MultiExtended)]
5618
[InlineData(
SelectionMode
.MultiSimple)]
5619
public void ListBoxObjectCollection_Remove_WithMultipleSelectedItemsNotSorted_Success(
SelectionMode
selectionMode)
5669
[InlineData(
SelectionMode
.MultiExtended)]
5670
[InlineData(
SelectionMode
.MultiSimple)]
5671
public void ListBoxObjectCollection_Remove_WithMultipleSelectedItemsSorted_Success(
SelectionMode
selectionMode)
5842
[InlineData(
SelectionMode
.MultiExtended)]
5843
[InlineData(
SelectionMode
.MultiSimple)]
5844
public void ListBoxObjectCollection_Remove_WithMultipleSelectedItemsNotSortedWithHandle_Success(
SelectionMode
selectionMode)
5910
[InlineData(
SelectionMode
.MultiExtended)]
5911
[InlineData(
SelectionMode
.MultiSimple)]
5912
public void ListBoxObjectCollection_Remove_WithMultipleSelectedItemsSortedWithHandle_Success(
SelectionMode
selectionMode)
6472
[InlineData(
SelectionMode
.MultiExtended)]
6473
[InlineData(
SelectionMode
.MultiSimple)]
6474
public void ListBoxObjectCollection_RemoveAt_WithMultipleSelectedItemsNotSorted_Success(
SelectionMode
selectionMode)
6524
[InlineData(
SelectionMode
.MultiExtended)]
6525
[InlineData(
SelectionMode
.MultiSimple)]
6526
public void ListBoxObjectCollection_RemoveAt_WithMultipleSelectedItemsSorted_Success(
SelectionMode
selectionMode)
6697
[InlineData(
SelectionMode
.MultiExtended)]
6698
[InlineData(
SelectionMode
.MultiSimple)]
6699
public void ListBoxObjectCollection_RemoveAt_WithMultipleSelectedItemsNotSortedWithHandle_Success(
SelectionMode
selectionMode)
6765
[InlineData(
SelectionMode
.MultiExtended)]
6766
[InlineData(
SelectionMode
.MultiSimple)]
6767
public void ListBoxObjectCollection_RemoveAt_WithMultipleSelectedItemsSortedWithHandle_Success(
SelectionMode
selectionMode)
7569
[InlineData(
SelectionMode
.MultiExtended)]
7570
[InlineData(
SelectionMode
.MultiSimple)]
7571
public void ListBoxObjectCollection_IListItem_SetWithMultipleSelectedItemsNotSorted_Success(
SelectionMode
selectionMode)
7638
[InlineData(
SelectionMode
.MultiExtended)]
7639
[InlineData(
SelectionMode
.MultiSimple)]
7640
public void ListBoxObjectCollection_IListItem_SetWithMultipleSelectedItemsSorted_Success(
SelectionMode
selectionMode)
7851
[InlineData(
SelectionMode
.MultiExtended)]
7852
[InlineData(
SelectionMode
.MultiSimple)]
7853
public void ListBoxObjectCollection_IListItem_SetWithMultipleSelectedItemsNotSortedWithHandle_Success(
SelectionMode
selectionMode)
7950
[InlineData(
SelectionMode
.MultiExtended)]
7951
[InlineData(
SelectionMode
.MultiSimple)]
7952
public void ListBoxObjectCollection_IListItem_SetWithMultipleSelectedItemsSortedWithHandle_Success(
SelectionMode
selectionMode)
8655
[InlineData(
SelectionMode
.MultiExtended)]
8656
[InlineData(
SelectionMode
.MultiSimple)]
8657
public void ListBoxObjectCollection_IListAdd_WithMultipleSelectedItemsNotSorted_Success(
SelectionMode
selectionMode)
8699
[InlineData(
SelectionMode
.MultiExtended)]
8700
[InlineData(
SelectionMode
.MultiSimple)]
8701
public void ListBoxObjectCollection_IListAdd_WithMultipleSelectedItemsSorted_Success(
SelectionMode
selectionMode)
8827
[InlineData(
SelectionMode
.MultiExtended)]
8828
[InlineData(
SelectionMode
.MultiSimple)]
8829
public void ListBoxObjectCollection_IListAdd_WithMultipleSelectedItemsNotSortedWithHandle_Succes(
SelectionMode
selectionMode)
8887
[InlineData(
SelectionMode
.MultiExtended)]
8888
[InlineData(
SelectionMode
.MultiSimple)]
8889
public void ListBoxObjectCollection_IListAdd_WithMultipleSelectedItemsSortedWithHandle_Succes(
SelectionMode
selectionMode)
9989
[InlineData(
SelectionMode
.MultiExtended)]
9990
[InlineData(
SelectionMode
.MultiSimple)]
9991
public void ListBoxObjectCollection_IListInsert_WithMultipleSelectedItemsNotSorted_Success(
SelectionMode
selectionMode)
10033
[InlineData(
SelectionMode
.MultiExtended)]
10034
[InlineData(
SelectionMode
.MultiSimple)]
10035
public void ListBoxObjectCollection_IListInsert_WithMultipleSelectedItemsSorted_Success(
SelectionMode
selectionMode)
10159
[InlineData(
SelectionMode
.MultiExtended)]
10160
[InlineData(
SelectionMode
.MultiSimple)]
10161
public void ListBoxObjectCollection_IListInsert_WithMultipleSelectedItemsNotSortedWithHandle_Succes(
SelectionMode
selectionMode)
10219
[InlineData(
SelectionMode
.MultiExtended)]
10220
[InlineData(
SelectionMode
.MultiSimple)]
10221
public void ListBoxObjectCollection_IListInsert_WithMultipleSelectedItemsSortedWithHandle_Succes(
SelectionMode
selectionMode)
10939
[InlineData(
SelectionMode
.MultiExtended)]
10940
[InlineData(
SelectionMode
.MultiSimple)]
10941
public void ListBoxObjectCollection_IListRemove_WithMultipleSelectedItemsNotSorted_Success(
SelectionMode
selectionMode)
10991
[InlineData(
SelectionMode
.MultiExtended)]
10992
[InlineData(
SelectionMode
.MultiSimple)]
10993
public void ListBoxObjectCollection_IListRemove_WithMultipleSelectedItemsSorted_Success(
SelectionMode
selectionMode)
11164
[InlineData(
SelectionMode
.MultiExtended)]
11165
[InlineData(
SelectionMode
.MultiSimple)]
11166
public void ListBoxObjectCollection_IListRemove_WithMultipleSelectedItemsNotSortedWithHandle_Success(
SelectionMode
selectionMode)
11232
[InlineData(
SelectionMode
.MultiExtended)]
11233
[InlineData(
SelectionMode
.MultiSimple)]
11234
public void ListBoxObjectCollection_IListRemove_WithMultipleSelectedItemsSortedWithHandle_Success(
SelectionMode
selectionMode)
11794
[InlineData(
SelectionMode
.MultiExtended)]
11795
[InlineData(
SelectionMode
.MultiSimple)]
11796
public void ListBoxObjectCollection_IListRemoveAt_WithMultipleSelectedItemsNotSorted_Success(
SelectionMode
selectionMode)
11846
[InlineData(
SelectionMode
.MultiExtended)]
11847
[InlineData(
SelectionMode
.MultiSimple)]
11848
public void ListBoxObjectCollection_IListRemoveAt_WithMultipleSelectedItemsSorted_Success(
SelectionMode
selectionMode)
12019
[InlineData(
SelectionMode
.MultiExtended)]
12020
[InlineData(
SelectionMode
.MultiSimple)]
12021
public void ListBoxObjectCollection_IListRemoveAt_WithMultipleSelectedItemsNotSortedWithHandle_Success(
SelectionMode
selectionMode)
12087
[InlineData(
SelectionMode
.MultiExtended)]
12088
[InlineData(
SelectionMode
.MultiSimple)]
12089
public void ListBoxObjectCollection_IListRemoveAt_WithMultipleSelectedItemsSortedWithHandle_Success(
SelectionMode
selectionMode)
System\Windows\Forms\ListBoxTests.cs (202)
116
Assert.Equal(
SelectionMode
.One, control.SelectionMode);
293
[InlineData(
SelectionMode
.MultiExtended, 0x562108C1)]
294
[InlineData(
SelectionMode
.MultiSimple, 0x562100C9)]
295
[InlineData(
SelectionMode
.None, 0x562140C1)]
296
[InlineData(
SelectionMode
.One, 0x562100C1)]
297
public void ListBox_CreateParams_GetSelectionMode_ReturnsExpected(
SelectionMode
selectionMode, int expectedStyle)
2294
[EnumData<
SelectionMode
>]
2295
public void ListBox_SelectedIndex_GetEmptyWithHandle_ReturnsMinusOne(
SelectionMode
selectionMode)
2307
[EnumData<
SelectionMode
>]
2308
public void ListBox_SelectedIndex_GetNotEmptyWithHandle_ReturnsMinusOne(
SelectionMode
selectionMode)
2321
[InlineData(
SelectionMode
.MultiExtended)]
2322
[InlineData(
SelectionMode
.MultiSimple)]
2323
[InlineData(
SelectionMode
.One)]
2324
public void ListBox_SelectedIndex_SetEmpty_GetReturnsExpected(
SelectionMode
selectionMode)
2351
SelectionMode =
SelectionMode
.One
2390
[InlineData(
SelectionMode
.MultiExtended)]
2391
[InlineData(
SelectionMode
.MultiSimple)]
2392
public void ListBox_SelectedIndex_SetSelectionModeMultiple_GetReturnsExpected(
SelectionMode
selectionMode)
2494
SelectionMode =
SelectionMode
.One
2552
[InlineData(
SelectionMode
.MultiExtended)]
2553
[InlineData(
SelectionMode
.MultiSimple)]
2554
public void ListBox_SelectedIndex_SetSelectionModeMultipleWithHandle_GetReturnsExpected(
SelectionMode
selectionMode)
2621
SelectionMode =
SelectionMode
.One
2642
[InlineData(
SelectionMode
.MultiExtended)]
2643
[InlineData(
SelectionMode
.MultiSimple)]
2644
public void ListBox_SelectedIndex_GetCurSelMultiple_Success(
SelectionMode
selectionMode)
2676
[InlineData(
SelectionMode
.One)]
2677
[InlineData(
SelectionMode
.MultiExtended)]
2678
[InlineData(
SelectionMode
.MultiSimple)]
2679
public void ListBox_SelectedIndex_SetWithHandler_CallsSelectedIndexChanged(
SelectionMode
selectionMode)
2751
SelectionMode =
SelectionMode
.None
2757
[EnumData<
SelectionMode
>]
2758
public void ListBox_SelectedItem_GetEmptyWithHandle_ReturnsNull(
SelectionMode
selectionMode)
2770
[EnumData<
SelectionMode
>]
2771
public void ListBox_SelectedItem_GetNotEmptyWithHandle_ReturnsNull(
SelectionMode
selectionMode)
2784
[InlineData(
SelectionMode
.MultiExtended, null)]
2785
[InlineData(
SelectionMode
.MultiSimple, null)]
2786
[InlineData(
SelectionMode
.One, null)]
2787
[InlineData(
SelectionMode
.MultiExtended, "item")]
2788
[InlineData(
SelectionMode
.MultiSimple, "item")]
2789
[InlineData(
SelectionMode
.One, "item")]
2790
public void ListBox_SelectedItem_SetEmpty_GetReturnsExpected(
SelectionMode
selectionMode, string value)
2817
SelectionMode =
SelectionMode
.One
2864
[InlineData(
SelectionMode
.MultiExtended)]
2865
[InlineData(
SelectionMode
.MultiSimple)]
2866
public void ListBox_SelectedItem_SetSelectionModeMultiple_GetReturnsExpected(
SelectionMode
selectionMode)
2985
SelectionMode =
SelectionMode
.One
3054
[InlineData(
SelectionMode
.MultiExtended)]
3055
[InlineData(
SelectionMode
.MultiSimple)]
3056
public void ListBox_SelectedItem_SetSelectionModeMultipleWithHandle_GetReturnsExpected(
SelectionMode
selectionMode)
3134
SelectionMode =
SelectionMode
.One
3159
[InlineData(
SelectionMode
.MultiExtended)]
3160
[InlineData(
SelectionMode
.MultiSimple)]
3161
public void ListBox_SelectedItem_GetCurSelMultiple_Success(
SelectionMode
selectionMode)
3200
[InlineData(
SelectionMode
.One)]
3201
[InlineData(
SelectionMode
.MultiExtended)]
3202
[InlineData(
SelectionMode
.MultiSimple)]
3203
public void ListBox_SelectedItem_SetWithHandler_CallsSelectedIndexChanged(
SelectionMode
selectionMode)
3263
SelectionMode =
SelectionMode
.None
3274
SelectionMode =
SelectionMode
.None
3292
SelectionMode =
SelectionMode
.MultiSimple
3356
[EnumData<
SelectionMode
>]
3357
public void ListBox_SelectionMode_SetEmpty_GetReturnsExpected(
SelectionMode
value)
3382
foreach (
SelectionMode
selectionMode in Enum.GetValues(typeof(
SelectionMode
)))
3384
foreach (
SelectionMode
value in Enum.GetValues(typeof(
SelectionMode
)))
3393
public void ListBox_SelectionMode_SetEmptyWithCustomOldValue_GetReturnsExpected(
SelectionMode
selectionMode,
SelectionMode
value)
3419
[InlineData(
SelectionMode
.MultiSimple)]
3420
[InlineData(
SelectionMode
.MultiExtended)]
3421
public void ListBox_SelectionMode_SetWithItemsOneSelectedToMulti_GetReturnsExpected(
SelectionMode
value)
3447
control.SelectionMode =
SelectionMode
.One;
3448
Assert.Equal(
SelectionMode
.One, control.SelectionMode);
3465
control.SelectionMode =
SelectionMode
.None;
3466
Assert.Equal(
SelectionMode
.None, control.SelectionMode);
3474
control.SelectionMode =
SelectionMode
.None;
3475
Assert.Equal(
SelectionMode
.None, control.SelectionMode);
3483
control.SelectionMode =
SelectionMode
.One;
3484
Assert.Equal(
SelectionMode
.One, control.SelectionMode);
3493
[InlineData(
SelectionMode
.MultiExtended)]
3494
[InlineData(
SelectionMode
.MultiSimple)]
3495
public void ListBox_SelectionMode_SetWithItemsMultiSelectedToOne_GetReturnsExpected(
SelectionMode
selectionMode)
3507
control.SelectionMode =
SelectionMode
.One;
3508
Assert.Equal(
SelectionMode
.One, control.SelectionMode);
3516
control.SelectionMode =
SelectionMode
.One;
3517
Assert.Equal(
SelectionMode
.One, control.SelectionMode);
3535
[InlineData(
SelectionMode
.MultiExtended)]
3536
[InlineData(
SelectionMode
.MultiSimple)]
3537
public void ListBox_SelectionMode_SetWithItemsMultiSelectedToNone_GetReturnsExpected(
SelectionMode
selectionMode)
3549
control.SelectionMode =
SelectionMode
.None;
3550
Assert.Equal(
SelectionMode
.None, control.SelectionMode);
3558
control.SelectionMode =
SelectionMode
.None;
3559
Assert.Equal(
SelectionMode
.None, control.SelectionMode);
3577
[InlineData(
SelectionMode
.None, 1)]
3578
[InlineData(
SelectionMode
.MultiExtended, 1)]
3579
[InlineData(
SelectionMode
.MultiSimple, 1)]
3580
[InlineData(
SelectionMode
.One, 0)]
3581
public void ListBox_SelectionMode_SetEmptyWithHandle_GetReturnsExpected(
SelectionMode
value, int expectedCreatedCallCount)
3617
yield return new object[] {
SelectionMode
.None,
SelectionMode
.None, 0 };
3618
yield return new object[] {
SelectionMode
.None,
SelectionMode
.MultiExtended, 1 };
3619
yield return new object[] {
SelectionMode
.None,
SelectionMode
.MultiSimple, 1 };
3620
yield return new object[] {
SelectionMode
.None,
SelectionMode
.One, 1 };
3622
yield return new object[] {
SelectionMode
.MultiExtended,
SelectionMode
.None, 1 };
3623
yield return new object[] {
SelectionMode
.MultiExtended,
SelectionMode
.MultiExtended, 0 };
3624
yield return new object[] {
SelectionMode
.MultiExtended,
SelectionMode
.MultiSimple, 1 };
3625
yield return new object[] {
SelectionMode
.MultiExtended,
SelectionMode
.One, 1 };
3627
yield return new object[] {
SelectionMode
.MultiSimple,
SelectionMode
.None, 1 };
3628
yield return new object[] {
SelectionMode
.MultiSimple,
SelectionMode
.MultiExtended, 1 };
3629
yield return new object[] {
SelectionMode
.MultiSimple,
SelectionMode
.MultiSimple, 0 };
3630
yield return new object[] {
SelectionMode
.MultiSimple,
SelectionMode
.One, 1 };
3632
yield return new object[] {
SelectionMode
.One,
SelectionMode
.None, 1 };
3633
yield return new object[] {
SelectionMode
.One,
SelectionMode
.MultiExtended, 1 };
3634
yield return new object[] {
SelectionMode
.One,
SelectionMode
.MultiSimple, 1 };
3635
yield return new object[] {
SelectionMode
.One,
SelectionMode
.One, 0 };
3640
public void ListBox_SelectionMode_SetEmptyWithCustomOldValueWithHandle_GetReturnsExpected(
SelectionMode
selectionMode,
SelectionMode
value, int expectedCreatedCallCount)
3679
[InlineData(
SelectionMode
.MultiSimple)]
3680
[InlineData(
SelectionMode
.MultiExtended)]
3681
public void ListBox_SelectionMode_SetWithItemsOneSelectedToMultiWithHandle_GetReturnsExpected(
SelectionMode
value)
3720
control.SelectionMode =
SelectionMode
.One;
3721
Assert.Equal(
SelectionMode
.One, control.SelectionMode);
3748
control.SelectionMode =
SelectionMode
.None;
3749
Assert.Equal(
SelectionMode
.None, control.SelectionMode);
3760
control.SelectionMode =
SelectionMode
.None;
3761
Assert.Equal(
SelectionMode
.None, control.SelectionMode);
3772
control.SelectionMode =
SelectionMode
.One;
3773
Assert.Equal(
SelectionMode
.One, control.SelectionMode);
3785
[InlineData(
SelectionMode
.MultiExtended)]
3786
[InlineData(
SelectionMode
.MultiSimple)]
3787
public void ListBox_SelectionMode_SetWithItemsMultiSelectedToOneWithHandle_GetReturnsExpected(
SelectionMode
selectionMode)
3806
control.SelectionMode =
SelectionMode
.One;
3807
Assert.Equal(
SelectionMode
.One, control.SelectionMode);
3818
control.SelectionMode =
SelectionMode
.One;
3819
Assert.Equal(
SelectionMode
.One, control.SelectionMode);
3843
[InlineData(
SelectionMode
.MultiExtended)]
3844
[InlineData(
SelectionMode
.MultiSimple)]
3845
public void ListBox_SelectionMode_SetWithItemsMultiSelectedToNoneWithHandle_GetReturnsExpected(
SelectionMode
selectionMode)
3864
control.SelectionMode =
SelectionMode
.None;
3865
Assert.Equal(
SelectionMode
.None, control.SelectionMode);
3876
control.SelectionMode =
SelectionMode
.None;
3877
Assert.Equal(
SelectionMode
.None, control.SelectionMode);
3901
[InvalidEnumData<
SelectionMode
>]
3902
public void ListBox_SelectionMode_SetInvalidValue_ThrowsInvalidEnumArgumentException(
SelectionMode
value)
4136
yield return new object[] { formattingEnabled,
SelectionMode
.None, null, string.Empty, -1 };
4137
yield return new object[] { formattingEnabled,
SelectionMode
.None, string.Empty, string.Empty, -1 };
4138
yield return new object[] { formattingEnabled,
SelectionMode
.None, "NoSuchItem", "NoSuchItem", -1 };
4139
yield return new object[] { formattingEnabled,
SelectionMode
.None, "item1", "item1", -1 };
4140
yield return new object[] { formattingEnabled,
SelectionMode
.None, "ITEM1", "ITEM1", -1 };
4141
yield return new object[] { formattingEnabled,
SelectionMode
.None, "item2", "item2", -1 };
4143
foreach (
SelectionMode
selectionMode in new
SelectionMode
[] {
SelectionMode
.MultiExtended,
SelectionMode
.MultiSimple,
SelectionMode
.One })
4157
public void ListBox_Text_SetWithItems_GetReturnsExpected(bool formattingEnabled,
SelectionMode
selectionMode, string value, string expected, int expectedSelectedIndex)
4184
yield return new object[] { formattingEnabled,
SelectionMode
.None, null, string.Empty, -1 };
4185
yield return new object[] { formattingEnabled,
SelectionMode
.None, string.Empty, string.Empty, -1 };
4186
yield return new object[] { formattingEnabled,
SelectionMode
.None, "NoSuchItem", "NoSuchItem", -1 };
4187
yield return new object[] { formattingEnabled,
SelectionMode
.None, "item1", "item1", -1 };
4188
yield return new object[] { formattingEnabled,
SelectionMode
.None, "ITEM1", "ITEM1", -1 };
4189
yield return new object[] { formattingEnabled,
SelectionMode
.None, "item2", "item2", -1 };
4191
foreach (
SelectionMode
selectionMode in new
SelectionMode
[] {
SelectionMode
.MultiExtended,
SelectionMode
.MultiSimple,
SelectionMode
.One })
4200
yield return new object[] { formattingEnabled,
SelectionMode
.MultiExtended, "item2", "item1", 0 };
4201
yield return new object[] { formattingEnabled,
SelectionMode
.MultiSimple, "item2", "item1", 0 };
4202
yield return new object[] { formattingEnabled,
SelectionMode
.One, "item2", "item2", 1 };
4208
public void ListBox_Text_SetWithItemsWithSelection_GetReturnsExpected(bool formattingEnabled,
SelectionMode
selectionMode, string value, string expected, int expectedSelectedIndex)
6149
[InlineData(
SelectionMode
.MultiSimple, true)]
6150
[InlineData(
SelectionMode
.MultiSimple, false)]
6151
[InlineData(
SelectionMode
.MultiExtended, true)]
6152
[InlineData(
SelectionMode
.MultiExtended, false)]
6153
public void ListBox_Remove_NotSelectedItems_IfSeveralItemsSelected(
SelectionMode
mode, bool createControl)
6225
[InlineData(
SelectionMode
.MultiSimple, true)]
6226
[InlineData(
SelectionMode
.MultiSimple, false)]
6227
[InlineData(
SelectionMode
.MultiExtended, true)]
6228
[InlineData(
SelectionMode
.MultiExtended, false)]
6229
public void ListBox_Remove_SelectedItems(
SelectionMode
mode, bool createControl)
6324
listBox.SelectionMode =
SelectionMode
.None;
6335
[InlineData(
SelectionMode
.One)]
6336
[InlineData(
SelectionMode
.MultiSimple)]
6337
[InlineData(
SelectionMode
.MultiExtended)]
6338
public void ListBox_SelectionModeValid_DoesNotThrow(
SelectionMode
selectionMode)
WinFormsControlsTest (1)
ListBoxes.Designer.cs (1)
68
this.listBox1.SelectionMode =
SelectionMode
.MultiSimple;