diff --git a/src/System.Windows.Forms.Design/src/Properties/InternalsVisibleTo.cs b/src/System.Windows.Forms.Design/src/Properties/InternalsVisibleTo.cs index 0741412e41c..3e7514f6c88 100644 --- a/src/System.Windows.Forms.Design/src/Properties/InternalsVisibleTo.cs +++ b/src/System.Windows.Forms.Design/src/Properties/InternalsVisibleTo.cs @@ -4,4 +4,5 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("System.Windows.Forms.Design.Tests, PublicKey=00000000000000000400000000000000")] \ No newline at end of file +[assembly: InternalsVisibleTo("System.Windows.Forms.Design.Tests, PublicKey=00000000000000000400000000000000")] +[assembly: InternalsVisibleTo("WinformsControlsTest, PublicKey=00000000000000000400000000000000")] diff --git a/src/System.Windows.Forms.Design/src/Resources/SR.resx b/src/System.Windows.Forms.Design/src/Resources/SR.resx index 7593eb44755..f17e17ad53a 100644 --- a/src/System.Windows.Forms.Design/src/Resources/SR.resx +++ b/src/System.Windows.Forms.Design/src/Resources/SR.resx @@ -747,4 +747,19 @@ '{0}' - + + Cancel + + + &Help + + + Enter the integers in the array (one per line): + + + &OK + + + Integer Collection Editor + + \ No newline at end of file diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.cs.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.cs.xlf index 368bef2d700..1b9abdd682b 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.cs.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.cs.xlf @@ -503,6 +503,31 @@ Jen pro čtení + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. Hodnota {1} není platnou hodnotou pro argument {0}. diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.de.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.de.xlf index 4d1a1a12d80..7a8367964cd 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.de.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.de.xlf @@ -503,6 +503,31 @@ Schreibgeschützt + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. {1} ist kein gültiger Wert für {0}. diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.es.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.es.xlf index f9a40861830..fff439e90a7 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.es.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.es.xlf @@ -503,6 +503,31 @@ Solo lectura + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. '{1}' no es un valor válido para '{0}'. diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.fr.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.fr.xlf index bf5eafb0e07..81dfe9305d8 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.fr.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.fr.xlf @@ -503,6 +503,31 @@ En lecture seule + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. '{1}' n'est pas une valeur valide pour '{0}'. diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.it.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.it.xlf index 9061ed5f4e8..aed855c7fe5 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.it.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.it.xlf @@ -503,6 +503,31 @@ Sola lettura + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. '{1}' non è un valore valido per '{0}'. diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ja.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ja.xlf index f592a641d53..66e42039893 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ja.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ja.xlf @@ -503,6 +503,31 @@ 読み取り専用 + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. '{1}' は '{0}' に有効な値ではありません。 diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ko.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ko.xlf index dd9c610952b..869c2d8f1d3 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ko.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ko.xlf @@ -503,6 +503,31 @@ 읽기 전용 + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. '{1}'은(는) '{0}'에 사용할 수 없는 값입니다. diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pl.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pl.xlf index 8aca0938a44..6cf53c46008 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pl.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pl.xlf @@ -503,6 +503,31 @@ Tylko do odczytu + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. „{1}” nie jest prawidłową wartością elementu „{0}”. diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pt-BR.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pt-BR.xlf index bf82ee5d991..760a7c38507 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pt-BR.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.pt-BR.xlf @@ -503,6 +503,31 @@ Somente Leitura + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. '{1}' não é um valor válido para '{0}'. diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ru.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ru.xlf index 8ed37b32ce6..b4587b03a1e 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ru.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.ru.xlf @@ -503,6 +503,31 @@ Только для чтения + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. '{1}' не является допустимым значением для '{0}'. diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.tr.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.tr.xlf index 9514c98b05d..f5690ed004a 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.tr.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.tr.xlf @@ -503,6 +503,31 @@ Salt Okunur + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. '{1}' değeri '{0}' öğesi için geçerli değil. diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hans.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hans.xlf index 221986e06e5..dff0b3afc62 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hans.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hans.xlf @@ -503,6 +503,31 @@ 只读 + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. “{1}”不是“{0}”的有效值。 diff --git a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hant.xlf b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hant.xlf index 201b5d5c268..3b22934b1ad 100644 --- a/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hant.xlf +++ b/src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hant.xlf @@ -503,6 +503,31 @@ 唯讀 + + Cancel + Cancel + + + + &Help + &Help + + + + Enter the integers in the array (one per line): + Enter the integers in the array (one per line): + + + + &OK + &OK + + + + Integer Collection Editor + Integer Collection Editor + + '{1}' is not a valid value for '{0}'. '{1}' 不是 '{0}' 的有效值。 diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/IntegerCollectionEditor.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/IntegerCollectionEditor.cs new file mode 100644 index 00000000000..ff4e94663f4 --- /dev/null +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/IntegerCollectionEditor.cs @@ -0,0 +1,246 @@ +// 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.Design; +using System.Drawing; +using System.Globalization; + +namespace System.Windows.Forms.Design +{ + /// + /// The is a collection editor that is specifically + /// designed to edit collections containing Integers. + /// + internal class IntegerCollectionEditor : CollectionEditor + { + public IntegerCollectionEditor(Type type) + : base(type) + { + } + + /// + /// Creates a new form to show the current collection. + /// You may inherit from CollectionForm to provide your own form. + /// + protected override CollectionForm CreateCollectionForm() => new IntegerCollectionForm(this); + + /// + ///Gets the help topic to display for the dialog help button or pressing F1. + /// Override to display a different help topic. + /// + protected override string HelpTopic => "net.ComponentModel.IntegerCollectionEditor"; + + /// + /// IntegerCollectionEditor allows visible editing of a integer array. + /// Each line in the edit box is an array entry. + /// + private class IntegerCollectionForm : CollectionForm + { + private readonly IntegerCollectionEditor _editor; + private readonly Label _instruction = new Label(); + private readonly TextBox _textEntry = new TextBox(); + private readonly Button _okButton = new Button(); + private readonly Button _cancelButton = new Button(); + private readonly Button _helpButton = new Button(); + + /// + /// Constructs a StringCollectionForm. + /// + public IntegerCollectionForm(CollectionEditor editor) + : base(editor) + { + _editor = (IntegerCollectionEditor)editor; + InitializeComponent(); + } + + private void Edit1_keyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode != Keys.Escape) + { + return; + } + + _cancelButton.PerformClick(); + e.Handled = true; + } + + private void HelpButton_click(object sender, EventArgs e) => _editor.ShowHelp(); + + private void Form_HelpRequested(object sender, HelpEventArgs e) => _editor.ShowHelp(); + + /// + /// NOTE: The following code is required by the form designer. It can be modified using the form editor. + /// Do not modify it using the code editor. + /// + private void InitializeComponent() + { + _instruction.Location = new Point(4, 7); + _instruction.Size = new Size(422, 14); + _instruction.TabIndex = 0; + _instruction.TabStop = false; + _instruction.Text = SR.IntegerCollectionEditorInstruction; + + _textEntry.Location = new Point(4, 22); + _textEntry.Size = new Size(422, 244); + _textEntry.TabIndex = 0; + _textEntry.Text = ""; + _textEntry.AcceptsTab = false; + _textEntry.AcceptsReturn = true; + _textEntry.AutoSize = false; + _textEntry.Multiline = true; + _textEntry.ScrollBars = ScrollBars.Both; + _textEntry.WordWrap = false; + _textEntry.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; + _textEntry.KeyDown += new KeyEventHandler(Edit1_keyDown); + + _okButton.Location = new Point(185, 274); + _okButton.Size = new Size(75, 23); + _okButton.TabIndex = 1; + _okButton.Text = SR.IntegerCollectionEditorOKCaption; + _okButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + _okButton.DialogResult = DialogResult.OK; + _okButton.Click += new EventHandler(OKButton_click); + + _cancelButton.Location = new Point(264, 274); + _cancelButton.Size = new Size(75, 23); + _cancelButton.TabIndex = 2; + _cancelButton.Text = SR.IntegerCollectionEditorCancelCaption; + _cancelButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + _cancelButton.DialogResult = DialogResult.Cancel; + + _helpButton.Location = new Point(343, 274); + _helpButton.Size = new Size(75, 23); + _helpButton.TabIndex = 3; + _helpButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + _helpButton.Text = SR.IntegerCollectionEditorHelpCaption; + _helpButton.Click += new EventHandler(HelpButton_click); + HelpRequested += new HelpEventHandler(Form_HelpRequested); + + Location = new Point(7, 7); + Text = SR.IntegerCollectionEditorTitle; + AcceptButton = _okButton; + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + AutoScaleDimensions = new SizeF(6, 13); + CancelButton = _cancelButton; + ClientSize = new Size(429, 307); + MaximizeBox = false; + MinimizeBox = false; + ControlBox = false; + ShowInTaskbar = false; + // VSWhidbey 94233: Force the dialog to open using FormStartPosition.CenterScreen. + StartPosition = FormStartPosition.CenterScreen; + MinimumSize = new Size(300, 200); + + Controls.Clear(); + Controls.AddRange(new Control[] { + _instruction, + _textEntry, + _okButton, + _cancelButton, + _helpButton + }); + } + + /// + /// + /// Commits the changes to the editor. + /// + private void OKButton_click(object sender, EventArgs e) + { + char[] delims = new char[] { '\n' }; + char[] trims = new char[] { '\r' }; + + string[] strings = _textEntry.Text.Split(delims); + object[] curItems = Items; + + int nItems = strings.Length; + // If the final line is blank, we don't want to create an item from it + // + if (strings.Length > 0 && strings[strings.Length - 1].Length == 0) + { + nItems--; + } + int[] currentValues = new int[nItems]; + + for (int i = 0; i < nItems; i++) + { + strings[i] = strings[i].Trim(trims); + try + { + currentValues[i] = Int32.Parse(strings[i], CultureInfo.CurrentCulture); + } + catch (Exception ex) + { + DisplayError(ex); + if (ClientUtils.IsCriticalException(ex)) + { + throw; + } + } + + } + + bool dirty = true; + + if (nItems == curItems.Length) + { + int i; + for (i = 0; i < nItems; ++i) + { + if (!currentValues[i].Equals((int)curItems[i])) + { + break; + } + } + + if (i == nItems) + { + dirty = false; + } + } + + if (!dirty) + { + DialogResult = DialogResult.Cancel; + return; + } + + object[] values = new object[nItems]; + for (int i = 0; i < nItems; i++) + { + values[i] = currentValues[i]; + } + + Items = values; + } + + // + // This is called when the value property in the CollectionForm has changed. + // In it you should update your user interface to reflect the current value. + // + // + protected override void OnEditValueChanged() + { + object[] items = Items; + string text = string.Empty; + + for (int i = 0; i < items.Length; i++) + { + if (items[i] is int) + { + text += ((Int32)items[i]).ToString(CultureInfo.CurrentCulture); + if (i != items.Length - 1) + { + text += "\r\n"; + } + } + } + + _textEntry.Text = text; + } + } + } +} + + diff --git a/src/System.Windows.Forms/tests/IntegrationTests/WinFormsControlsClassicTests/WinFormsControlsClassicTests.csproj b/src/System.Windows.Forms/tests/IntegrationTests/WinFormsControlsClassicTests/WinFormsControlsClassicTests.csproj index 938c7f37f2a..26f19f0f795 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/WinFormsControlsClassicTests/WinFormsControlsClassicTests.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/WinFormsControlsClassicTests/WinFormsControlsClassicTests.csproj @@ -20,13 +20,11 @@ false - msbuild - - + AnyCPU true @@ -224,6 +222,10 @@ TreeViewTest.Designer.cs TreeViewTest.cs + + UserControls\UserControlWithCollectionEditors.cs + UserControl + UserControls\UserControlWithFontNameEditor.cs UserControl diff --git a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/MainForm.Designer.cs b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/MainForm.Designer.cs index 2ba025028ae..14d54caa419 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/MainForm.Designer.cs +++ b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/MainForm.Designer.cs @@ -50,6 +50,7 @@ private void InitializeComponent() this.ShowExceptionDialogButton = new System.Windows.Forms.Button(); this.flowLayoutPanelUITypeEditors = new System.Windows.Forms.FlowLayoutPanel(); this.fontNameEditor = new System.Windows.Forms.Button(); + this.collectionEditors = new System.Windows.Forms.Button(); this.flowLayoutPanelUITypeEditors.SuspendLayout(); this.SuspendLayout(); // @@ -234,6 +235,7 @@ private void InitializeComponent() this.flowLayoutPanelUITypeEditors.Controls.Add(this.propertyGrid); this.flowLayoutPanelUITypeEditors.Controls.Add(this.listViewButton); this.flowLayoutPanelUITypeEditors.Controls.Add(this.fontNameEditor); + this.flowLayoutPanelUITypeEditors.Controls.Add(this.collectionEditors); this.flowLayoutPanelUITypeEditors.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanelUITypeEditors.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanelUITypeEditors.Location = new System.Drawing.Point(8, 8); @@ -252,6 +254,17 @@ private void InitializeComponent() this.fontNameEditor.UseVisualStyleBackColor = true; this.fontNameEditor.Click += new System.EventHandler(this.FontNameEditor_Click); // + // collectionEditors + // + this.collectionEditors.Location = new System.Drawing.Point(267, 228); + this.collectionEditors.Margin = new System.Windows.Forms.Padding(2); + this.collectionEditors.Name = "collectionEditors"; + this.collectionEditors.Size = new System.Drawing.Size(258, 23); + this.collectionEditors.TabIndex = 16; + this.collectionEditors.Text = "CollectionEditors"; + this.collectionEditors.UseVisualStyleBackColor = true; + this.collectionEditors.Click += new System.EventHandler(this.CollectionEditors_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -288,6 +301,7 @@ private void InitializeComponent() private System.Windows.Forms.Button ShowExceptionDialogButton; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelUITypeEditors; private System.Windows.Forms.Button fontNameEditor; + private System.Windows.Forms.Button collectionEditors; } } diff --git a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/MainForm.cs b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/MainForm.cs index 8fe14c55447..f1ca3c485bf 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/MainForm.cs +++ b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/MainForm.cs @@ -4,8 +4,8 @@ using System; using System.Windows.Forms; -using WinformsControlsTest.UserControls; using System.Windows.Forms.IntegrationTests.Common; +using WinformsControlsTest.UserControls; namespace WinformsControlsTest { @@ -102,5 +102,10 @@ private void FontNameEditor_Click(object sender, EventArgs e) { new PropertyGrid(new UserControlWithFontNameEditor()).Show(); } + + private void CollectionEditors_Click(object sender, EventArgs e) + { + new PropertyGrid(new UserControlWithCollectionEditors()).Show(); + } } } diff --git a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/UserControls/UserControlWithCollectionEditors.cs b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/UserControls/UserControlWithCollectionEditors.cs new file mode 100644 index 00000000000..f647173c9be --- /dev/null +++ b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/UserControls/UserControlWithCollectionEditors.cs @@ -0,0 +1,57 @@ +// 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.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Windows.Forms; +using System; +#if NETCORE +using System.Drawing.Design; +using System.Windows.Forms.Design; +#endif + +namespace WinformsControlsTest.UserControls +{ + internal class UserControlWithCollectionEditors : UserControl + { + private const string Category = "!CollectionEditors"; + private int[] _intArray = Enumerable.Range(1, 10).ToArray(); + private Array _intLegacyArray = Enumerable.Range(1, 10).ToArray(); + private List _intList = Enumerable.Range(1, 10).ToList(); + + public UserControlWithCollectionEditors() + { + AutoScaleMode = AutoScaleMode.Font; + } + +#if NETCORE + [Editor(typeof(IntegerCollectionEditor), typeof(UITypeEditor))] +#endif + [Browsable(true)] + [EditorBrowsable(EditorBrowsableState.Always)] + [Category(Category)] + public int[] IntArray + { + get => _intArray; + set => _intArray = value; + } + +#if NETCORE + [Editor(typeof(IntegerCollectionEditor), typeof(UITypeEditor))] +#endif + [Browsable(true)] + [EditorBrowsable(EditorBrowsableState.Always)] + [Category(Category)] + public List IntList => _intList; + +#if NETCORE + [Editor(typeof(IntegerCollectionEditor), typeof(UITypeEditor))] +#endif + [Browsable(true)] + [EditorBrowsable(EditorBrowsableState.Always)] + [Category(Category)] + public Array IntLegacyArray => _intLegacyArray; + } +} diff --git a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/WinformsControlsTest.csproj b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/WinformsControlsTest.csproj index 9797d6a01c2..c554c05a4fd 100644 --- a/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/WinformsControlsTest.csproj +++ b/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/WinformsControlsTest.csproj @@ -10,6 +10,10 @@ app1.manifest + + NETCORE + + @@ -71,10 +75,6 @@ - - - - WinformsControlsTest.SmallA.bmp