dotnet / dotnet/winforms

Default CollectionEditor Appears instead of the Custom CollectionEditor When the Editor Opens from the UITypeEditor’s Custom Form

Open
#13,355 8 comments 0 reactions 1 assignee Assigned to @KlausLoeffelmann View on GitHub
area-VSDesigner
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### Environment

Microsoft Visual Studio Professional 2022 (64-bit) - Current
Version 17.13.6

### .NET version

Facing this issue in both .NET80 and .NET90.

### Did this work in a previous version of Visual Studio and/or previous .NET release?

_No response_

### Issue description

A custom CollectionEditor does not appear as expected when invoked from a custom form of a UITypeEditor. Instead, the default CollectionEditor is displayed, which prevents the intended custom editing functionality from being used.

If the CollectionEditor property is directly on the control's class, the custom CollectionEditor appears as expected. However, in our scenario, we are showing this property inside the property grid within the custom form of the UITypeEditor.

We would appreciate any guidance or suggestions on resolving this issue to display the custom CollectionEditor.

In the sample, the **MyCollection** property is bound with the **UITypeEditor**, which shows a custom form, and the **SubItems** property is bound with the **Custom CollectionEditor.**

**Demo link:**

[CustomControlLibrary_WithSample.zip](https://github.com/user-attachments/files/19861081/CustomControlLibrary_WithSample.zip)

NuGet is included in the above file.

**Issue replication video:**

https://github.com/user-attachments/assets/012ef103-b2ce-44ef-be72-e22bbfbde09b

### Steps to reproduce

1. Open the Designer.
2. Click the CustomControl and go to the property window.
3. Now, open the custom form of the "MyCollection" property.
4. Press the "Add" button.
5. Open the editor of the "SubItems" property inside the custom form's property grid.

**Expected Behavior** - The custom Collection Editor should be shown.
**Observed Behavior** - The default Collection Editor was shown.

**Note: The same "SubItems" property is directly available on the custom control, and it displays the custom CollectionEditor properly.**

### Diagnostics

```text

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.