dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.37k stars 968 forks source link

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

Closed Sekar47 closed 3 weeks ago

Sekar47 commented 1 month ago

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

KlausLoeffelmann commented 3 weeks ago

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/