Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine PropertyGrid tab information. #6108

Merged
merged 2 commits into from
Nov 3, 2021
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
Expand Up @@ -35,7 +35,7 @@ public int Count
return 0;
}

return _ownerPropertyGrid._viewTabs.Length;
return _ownerPropertyGrid._tabs.Count;
}
}

Expand All @@ -55,7 +55,7 @@ public PropertyTab this[int index]
throw new InvalidOperationException(SR.PropertyGridPropertyTabCollectionReadOnly);
}

return _ownerPropertyGrid._viewTabs[index];
return _ownerPropertyGrid._tabs[index].Tab;
}
}

Expand Down Expand Up @@ -100,9 +100,14 @@ void ICollection.CopyTo(Array dest, int index)
return;
}

if (_ownerPropertyGrid._viewTabs.Length > 0)
if (_ownerPropertyGrid._tabs.Count > 0)
{
Array.Copy(_ownerPropertyGrid._viewTabs, 0, dest, index, _ownerPropertyGrid._viewTabs.Length);
Array.Copy(
_ownerPropertyGrid._tabs.Select(i => i.Tab).ToArray(),
0,
dest,
index,
_ownerPropertyGrid._tabs.Count);
}
}

Expand All @@ -116,7 +121,7 @@ public IEnumerator GetEnumerator()
return Array.Empty<PropertyTab>().GetEnumerator();
}

return _ownerPropertyGrid._viewTabs.GetEnumerator();
return _ownerPropertyGrid._tabs.Select(i => i.Tab).GetEnumerator();
}

public void RemoveTabType(Type propertyTabType)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// 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;
using System.Windows.Forms.Design;

namespace System.Windows.Forms
{
public partial class PropertyGrid
{
private record TabInfo(PropertyTab Tab, PropertyTabScope Scope, ToolStripButton Button)
{
public Type TabType => Tab.GetType();
}
}
}
Loading