winforms icon indicating copy to clipboard operation
winforms copied to clipboard

Incorrect Mouse Event Capturing During Design Time in .NET Core Projects Prevents Drag-and-Drop of Custom Docked Panel

Open NagarajManimaran opened this issue 4 months ago • 8 comments

Please take a look at this blog to find more information about building for the out-of-process designer. There are links to code samples and examples that should help you solve your issues here.

Originally posted by @merriemcgaw in #13177

NagarajManimaran avatar Aug 21 '25 12:08 NagarajManimaran

@merriemcgaw

Thank you for the update. We have followed the guidance provided in the referenced blog, but unfortunately, the drag-and-drop functionality for the Custom Docked Panel in our WinForms .NET Core application is still not working as expected.

Could you kindly suggest any possible workaround or interim solution to implement this feature?

Additionally, is there a preview version or upcoming release that might include support for this functionality? If so, we would appreciate any guidance on how to test it or provide feedback.

NagarajManimaran avatar Aug 21 '25 12:08 NagarajManimaran

I will look into it.

Epica3055 avatar Aug 22 '25 02:08 Epica3055

I studied your project and I think your approach won't work in .Net winform. Because in .Net framework, window designer shares the same process with visual studio since they are same framework

That's not the case with .Net winform. It is not compatible wth visual studio because they are not same framework. It acutally runs in another process.

you might want to study this blog 😊

Epica3055 avatar Aug 25 '25 09:08 Epica3055

@Epica3055 ,

I reviewed the shared blog and tried the following approaches to implement design-time support in .NET Core WinForms:

  1. I implemented a client-server architecture where the designer is hosted on the server side. I added the appropriate attributes in the TypeRoutingProvider and tested the sample with these changes. However, I still encountered the same issue — mouse messages (msg = 0) and paint events were triggered unexpectedly in .NET Core.

  2. I also tried applying the designer changes on the client side and included some source code modifications. But with these changes, the Form.Design view failed to open in Visual Studio.

Could you please clarify how to properly implement the designer support based on the approach shared in your blog? If there is any documentation or sample project available, I would appreciate it if you could share it.

NagarajManimaran avatar Oct 14 '25 06:10 NagarajManimaran

Hi @Epica3055 ,

Any updates regarding our query GitHub Issue? https://github.com/dotnet/winforms/issues/13827#issuecomment-3400343774 If there is any alternative solution for designer support in .NET Core, please share.

NagarajManimaran avatar Nov 18 '25 11:11 NagarajManimaran

Can you give us more details about what errors you are seeing when you migrate to the client/server approach for .NET Core? If you enable verbose logging (Tools->Options->All Settings ->Windows Forms Designer -> .NET Core ->Logging Level) you might be able to identify more what the problem is.

merriemcgaw avatar Nov 21 '25 00:11 merriemcgaw

Hi @merriemcgaw ,

I have attached a video reference and sample projects (for .NET Core and .NET Framework) to demonstrate the issues we are facing.

Video reference:

core: https://github.com/user-attachments/assets/a7c9fbe8-776c-4c65-b268-1c38d11b4cb1

framework: https://github.com/user-attachments/assets/b9daa01a-bf37-4447-82ee-6d8f0cf94c28

Sample projects Core.zip frame.zip

In .NET Core: When we click the docked panel, the mouse message returns an incorrect value. As a result, mouse-related functions such as MouseDown, MouseUp, and drag-and-drop do not work. This prevents us from dragging the panel to a new location at design time.

In .NET Framework: When we click the docked panel, the mouse message updates correctly. Therefore, mouse-related functions work as expected, and we can easily drag the docked panel to a new location at design time.

From my investigation, it seems that the designer runs out-of-process in .NET Core, which might be causing the issue.

Additionally, I have attached a sample project (Project1) demonstrating a client-server approach. In this example, I moved the designer to the server side and included the necessary attributes. However, the mouse message still passes incorrect values."

sample client-server project: Project1.zip

NagarajManimaran avatar Nov 21 '25 06:11 NagarajManimaran

@KlausLoeffelmann can you take a look and see if you can offer any suggestions or if there is something we need to add to the designer SDK?

merriemcgaw avatar Nov 24 '25 17:11 merriemcgaw