diff --git a/src/System.Design/src/System.Design.Forwards.cs b/src/System.Design/src/System.Design.Forwards.cs new file mode 100644 index 00000000000..18f1bd005b0 --- /dev/null +++ b/src/System.Design/src/System.Design.Forwards.cs @@ -0,0 +1,7 @@ +// 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.Runtime.CompilerServices; + +[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.ListControlStringCollectionEditor))] 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 ef1ef6903a2..321243c60fd 100644 --- a/src/System.Windows.Forms.Design.Editors/src/Resources/SR.resx +++ b/src/System.Windows.Forms.Design.Editors/src/Resources/SR.resx @@ -148,6 +148,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 Right Top 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 Picker Dockungsauswahl 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 Picker Selector 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 Picker Sé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 Picker Selezione 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 Picker Selektor 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 Picker Encaixar 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 Picker Seç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); + } + } +}