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

Can't be able to use the custom CollectionEditors in NetCore projects. #11821

Closed
Sekar47 opened this issue Aug 6, 2024 · 1 comment
Closed
Assignees
Labels
🚧 work in progress Work that is current in progress
Milestone

Comments

@Sekar47
Copy link

Sekar47 commented Aug 6, 2024

Environment

Edition - Windows 11 Enterprise
Version - 23H2
OS build - 22631.3737
Visual Studio version - 17.10.4

.NET version

.Net 6,7,8

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

No, it's not working in previous versions of netcore

Issue description

I am developing a .NET 6.0 WinForms application where I need to use a custom CustomCollectionEditor for a Bars property in my custom control. I have implemented the CustomCollectionEditor class inheriting from UITypeEditor. The custom editor is intended to display a modal dialog for editing the Bars collection when the Bars property is clicked in the designer.

The custom editor works correctly in a .NET Framework application. However, in the .NET 6.0 application, the custom editor is not invoked, and the standard CollectionEditor is shown instead. Here I've attached both Framework and NetCore samples for your reference.

CustomCollectionEditor-NetCoreSample.zip
CustomCollectionEditor-FramworkSample.zip

Steps to reproduce

Build the project and open the form designer.
Drag and drop the custom control onto the form.
In the properties window, click the ellipsis (...) button next to the Bars property.

Expected Behavior
The CustomCollectionEditor should be invoked, displaying a modal dialog for editing the Bars collection.

Actual Behavior
The standard CollectionEditor is displayed instead of the custom CustomCollectionEditor.

Diagnostics

No response

@Sekar47 Sekar47 added the untriaged The team needs to look at this issue in the next triage label Aug 6, 2024
@merriemcgaw merriemcgaw added this to the VS release milestone Aug 7, 2024
nirzaf added a commit to nirzaf/winforms that referenced this issue Aug 14, 2024
Fixes dotnet#11821

Add support for custom CollectionEditors in .NET Core projects.

* **CollectionEditor.cs**
  - Add a method `GetCustomEditor` to check for custom editors.
  - Modify the `EditValue` method to use the custom editor if available.

* **CollectionEditor.CollectionForm.cs**
  - Add a method `GetCustomEditor` to check for custom editors.

* **CollectionEditor.FilterListBox.cs**
  - Add support for custom drawing of list items by handling the `WM_DRAWITEM` message.
  - Implement the `ListBox_drawItem` method to draw custom list items.
@dotnet-policy-service dotnet-policy-service bot added the 🚧 work in progress Work that is current in progress label Aug 14, 2024
@KlausLoeffelmann
Copy link
Member

This is not a bug, this is by design of the Out-Of-Process Designer.
Please have a look at this blog post:

https://devblogs.microsoft.com/dotnet/custom-controls-for-winforms-out-of-process-designer/

@dotnet-policy-service dotnet-policy-service bot removed the untriaged The team needs to look at this issue in the next triage label Sep 5, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🚧 work in progress Work that is current in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants