Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// 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.Diagnostics;

namespace System.Windows.Forms.Design
{
/// <summary>
/// Main class for collection editor for <see cref="TabControl.TabPageCollection"/>.
/// Allows a single level of <see cref="ToolStripItem"/> children to be designed.
/// </summary>
internal class TabPageCollectionEditor : CollectionEditor
{
public TabPageCollectionEditor() : base(typeof(TabControl.TabPageCollection))
{
}

/// <summary>
/// Sets the specified collection to have the specified array of items.
/// </summary>
protected override object SetItems(object editValue, object[] value)
{
var tabControl = Context.Instance as TabControl;
tabControl?.SuspendLayout();

object retValue = base.SetItems(editValue, value);

tabControl?.ResumeLayout();
return retValue;
}

protected override object CreateInstance(Type itemType)
{
object instance = base.CreateInstance(itemType);

TabPage tabPage = instance as TabPage;
Debug.Assert(tabPage != null);
tabPage.UseVisualStyleBackColor = true;

return tabPage;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +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.

Expand Down Expand Up @@ -95,7 +95,7 @@ public void EnsureUITypeEditorForType(Type type, Type expectedEditorType)
//[InlineData(typeof(MaskedTextBox), "Text", typeof(MaskedTextBoxTextEditor))]
[InlineData(typeof(NotifyIcon), "BalloonTipText", typeof(MultilineStringEditor))]
[InlineData(typeof(NotifyIcon), "Text", typeof(MultilineStringEditor))]
//[InlineData(typeof(TabControl), "TabPages", typeof(TabPageCollectionEditor))]
[InlineData(typeof(TabControl), "TabPages", typeof(TabPageCollectionEditor))]
[InlineData(typeof(TabPage), "ImageIndex", typeof(ImageIndexEditor))]
[InlineData(typeof(TabPage), "ImageKey", typeof(ImageIndexEditor))]
//[InlineData(typeof(TextBox), "AutoCompleteCustomSource", typeof(ListControlStringCollectionEditor))]
Expand Down