diff --git a/src/System.Design/src/System.Design.Forwards.cs b/src/System.Design/src/System.Design.Forwards.cs
index 048d62c0fc0..9850a7e02f4 100644
--- a/src/System.Design/src/System.Design.Forwards.cs
+++ b/src/System.Design/src/System.Design.Forwards.cs
@@ -1,5 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
-// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
@@ -7,6 +6,7 @@
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.ImageCollectionEditor))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.ImageIndexEditor))]
+[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.ListControlStringCollectionEditor))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.StringArrayEditor))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.StringCollectionEditor))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.TabPageCollectionEditor))]
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/SR.resx b/src/System.Windows.Forms.Design.Editors/src/Resources/SR.resx
index c2424f730e9..c57b0613bfb 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/SR.resx
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/SR.resx
@@ -89,6 +89,9 @@
System
+
+ Items collection cannot be modified when the DataSource property is set.
+
Dock Picker
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.cs.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.cs.xlf
index 80b4c98dfa5..7990a4d0b5d 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.cs.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.cs.xlf
@@ -130,6 +130,11 @@
Top RightTop Right
+
+
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.de.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.de.xlf
index 1dab60a506b..6ea86df8133 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.de.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.de.xlf
@@ -132,6 +132,11 @@
Top Right
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
+
+ Dock PickerDockungsauswahl
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.es.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.es.xlf
index 4f411f9b813..9314ce44352 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.es.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.es.xlf
@@ -132,6 +132,11 @@
Top Right
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
+
+ Dock PickerSelector de acoplamiento
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.fr.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.fr.xlf
index 691b2d0573b..883e5bd2a65 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.fr.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.fr.xlf
@@ -132,6 +132,11 @@
Top Right
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
+
+ Dock PickerSélecteur de Dock
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.it.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.it.xlf
index 3fbc71b78ca..a08fb26fe6d 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.it.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.it.xlf
@@ -132,6 +132,11 @@
Top Right
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
+
+ Dock PickerSelezione ancoraggio
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.ja.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.ja.xlf
index ee1e6bb7c40..eba43c504b1 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.ja.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.ja.xlf
@@ -132,6 +132,11 @@
Top Right
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
+
+ Dock Pickerピッカーのドッキング
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.ko.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.ko.xlf
index 0805a3e215d..fcaeb30077b 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.ko.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.ko.xlf
@@ -132,6 +132,11 @@
Top Right
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
+
+ Dock Picker도킹 선택기
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.pl.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.pl.xlf
index 516921936db..de12588e8e9 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.pl.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.pl.xlf
@@ -132,6 +132,11 @@
Top Right
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
+
+ Dock PickerSelektor dokowania
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.pt-BR.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.pt-BR.xlf
index e2c9b2e7ea9..712ec5fcd4c 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.pt-BR.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.pt-BR.xlf
@@ -132,6 +132,11 @@
Top Right
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
+
+ Dock PickerEncaixar Seletor
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.ru.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.ru.xlf
index 645a02d51a8..fe8bbe04c7b 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.ru.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.ru.xlf
@@ -132,6 +132,11 @@
Top Right
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
+
+ Dock PickerСредство выбора дока
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.tr.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.tr.xlf
index 945ceb4a36a..f519445f98a 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.tr.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.tr.xlf
@@ -132,6 +132,11 @@
Top Right
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
+
+ Dock PickerSeçiciyi Yerleştir
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.zh-Hans.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.zh-Hans.xlf
index bc052e36f15..5116475e313 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.zh-Hans.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.zh-Hans.xlf
@@ -132,6 +132,11 @@
Top Right
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
+
+ Dock Picker停靠选取器
diff --git a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.zh-Hant.xlf b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.zh-Hant.xlf
index 007b67cd608..fc39f8f476f 100644
--- a/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.zh-Hant.xlf
+++ b/src/System.Windows.Forms.Design.Editors/src/Resources/xlf/SR.zh-Hant.xlf
@@ -132,6 +132,11 @@
Top Right
+
+ Items collection cannot be modified when the DataSource property is set.
+ Items collection cannot be modified when the DataSource property is set.
+
+ Dock Picker停駐選擇器
diff --git a/src/System.Windows.Forms.Design.Editors/src/System/Windows/Forms/Design/ListControlStringCollectionEditor.cs b/src/System.Windows.Forms.Design.Editors/src/System/Windows/Forms/Design/ListControlStringCollectionEditor.cs
new file mode 100644
index 00000000000..68743a7529a
--- /dev/null
+++ b/src/System.Windows.Forms.Design.Editors/src/System/Windows/Forms/Design/ListControlStringCollectionEditor.cs
@@ -0,0 +1,32 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms.Design
+{
+ ///
+ /// The ListControlStringCollectionEditor override StringCollectionEditor
+ /// to prevent the string collection from being edited if a DataSource
+ /// has been set on the control.
+ ///
+ internal class ListControlStringCollectionEditor : StringCollectionEditor
+ {
+ public ListControlStringCollectionEditor(Type type) : base(type)
+ {
+ }
+
+ public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
+ {
+ // If we're trying to edit the items in an object that has a DataSource set, throw an exception
+ ListControl control = context.Instance as ListControl;
+ if (control?.DataSource != null)
+ {
+ throw new ArgumentException(SR.DataSourceLocksItems);
+ }
+
+ return base.EditValue(context, provider, value);
+ }
+ }
+}
diff --git a/src/System.Windows.Forms.Design.Editors/tests/UnitTests/EnsureEditorsTests.cs b/src/System.Windows.Forms.Design.Editors/tests/UnitTests/EnsureEditorsTests.cs
index 5bcf2ea6845..51d5282a491 100644
--- a/src/System.Windows.Forms.Design.Editors/tests/UnitTests/EnsureEditorsTests.cs
+++ b/src/System.Windows.Forms.Design.Editors/tests/UnitTests/EnsureEditorsTests.cs
@@ -58,11 +58,11 @@ public void EnsureUITypeEditorForType(Type type, Type expectedEditorType)
[InlineData(typeof(ButtonBase), "ImageIndex", typeof(ImageIndexEditor))]
[InlineData(typeof(ButtonBase), "ImageKey", typeof(ImageIndexEditor))]
[InlineData(typeof(ButtonBase), "Text", typeof(MultilineStringEditor))]
- //[InlineData(typeof(CheckedListBox), "Items", typeof(ListControlStringCollectionEditor))]
+ [InlineData(typeof(CheckedListBox), "Items", typeof(ListControlStringCollectionEditor))]
[InlineData(typeof(ColumnHeader), "ImageIndex", typeof(ImageIndexEditor))]
[InlineData(typeof(ColumnHeader), "ImageKey", typeof(ImageIndexEditor))]
- //[InlineData(typeof(ComboBox), "AutoCompleteCustomSource", typeof(ListControlStringCollectionEditor))]
- //[InlineData(typeof(ComboBox), "Items", typeof(ListControlStringCollectionEditor))]
+ [InlineData(typeof(ComboBox), "AutoCompleteCustomSource", typeof(ListControlStringCollectionEditor))]
+ [InlineData(typeof(ComboBox), "Items", typeof(ListControlStringCollectionEditor))]
//[InlineData(typeof(DataGridView), "Columns", typeof(DataGridViewColumnCollectionEditor))]
//[InlineData(typeof(DataGridView), "DataMember", typeof(DataMemberListEditor))]
//[InlineData(typeof(DataGridViewCellStyle), "Format", typeof(FormatStringEditor))]
@@ -78,7 +78,7 @@ public void EnsureUITypeEditorForType(Type type, Type expectedEditorType)
[InlineData(typeof(Label), "ImageKey", typeof(ImageIndexEditor))]
[InlineData(typeof(Label), "Text", typeof(MultilineStringEditor))]
//[InlineData(typeof(LinkLabel), "LinkArea", typeof(LinkAreaEditor))]
- //[InlineData(typeof(ListBox), "Items", typeof(ListControlStringCollectionEditor))]
+ [InlineData(typeof(ListBox), "Items", typeof(ListControlStringCollectionEditor))]
//[InlineData(typeof(ListControl), "DisplayMember", typeof(DataMemberFieldEditor))]
//[InlineData(typeof(ListControl), "FormatString", typeof(FormatStringEditor))]
//[InlineData(typeof(ListControl), "ValueMember", typeof(DataMemberFieldEditor))]
@@ -96,15 +96,15 @@ public void EnsureUITypeEditorForType(Type type, Type expectedEditorType)
[InlineData(typeof(TabControl), "TabPages", typeof(TabPageCollectionEditor))]
[InlineData(typeof(TabPage), "ImageIndex", typeof(ImageIndexEditor))]
[InlineData(typeof(TabPage), "ImageKey", typeof(ImageIndexEditor))]
- //[InlineData(typeof(TextBox), "AutoCompleteCustomSource", typeof(ListControlStringCollectionEditor))]
+ [InlineData(typeof(TextBox), "AutoCompleteCustomSource", typeof(ListControlStringCollectionEditor))]
[InlineData(typeof(TextBoxBase), "Lines", typeof(StringArrayEditor))]
[InlineData(typeof(TextBoxBase), "Text", typeof(MultilineStringEditor))]
- //[InlineData(typeof(ToolStripComboBox), "AutoCompleteCustomSource", typeof(ListControlStringCollectionEditor))]
- //[InlineData(typeof(ToolStripComboBox), "Items", typeof(ListControlStringCollectionEditor))]
+ [InlineData(typeof(ToolStripComboBox), "AutoCompleteCustomSource", typeof(ListControlStringCollectionEditor))]
+ [InlineData(typeof(ToolStripComboBox), "Items", typeof(ListControlStringCollectionEditor))]
//[InlineData(typeof(ToolStripItem), "ImageIndex", typeof(ToolStripImageIndexEditor))]
//[InlineData(typeof(ToolStripItem), "ImageKey", typeof(ToolStripImageIndexEditor))]
[InlineData(typeof(ToolStripItem), "ToolTipText", typeof(MultilineStringEditor))]
- //[InlineData(typeof(ToolStripTextBox), "AutoCompleteCustomSource", typeof(ListControlStringCollectionEditor))]
+ [InlineData(typeof(ToolStripTextBox), "AutoCompleteCustomSource", typeof(ListControlStringCollectionEditor))]
[InlineData(typeof(ToolStripTextBox), "Lines", typeof(StringArrayEditor))]
[InlineData(typeof(TreeNode), "ImageIndex", typeof(ImageIndexEditor))]
[InlineData(typeof(TreeNode), "ImageKey", typeof(ImageIndexEditor))]