Incorrect Mouse Event Capturing During Design Time in .NET Core Projects Prevents Drag-and-Drop of Custom Docked Panel
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
@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.
I will look into it.
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 ,
I reviewed the shared blog and tried the following approaches to implement design-time support in .NET Core WinForms:
-
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.
-
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.
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.
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.
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
@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?