Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a Custom Design-Time Environment

My question is related to the design-time support of WPF. From MSDN I read,

The WPF Designer provides a framework and a public API which you can use to implement custom adorners, tools, property editors, and designers.

But the vast majority of the examples I have found are trivial, and do not illustrate much concerning the creation of a customized designer in an existing WPF application. We have migrated our application from Windows Forms to WPF over the past year, and the next step will be to take an existing WinForms Panel designer, and rewrite it in WPF.

Suffice it to say that this will be a huge project. But I don't even know where to begin. I am wondering if any of you have had similar experiences writing a customized designer for a WPF application, and what it was like. Even better, if you could compare and contrast the functionality between the WinForms designer and the WPF designer, or explain the transition from the former to the latter, that would be helpful. If you know of any simple examples that demonstrate a customized design environment (with custom controls, etc.) that would be extremely beneficial.

All in all, I am just wondering if many people have undertaken this yet, and what their results have been.

EDIT: To clarify, yes, I am talking about hosting a WPF designer. It appears that this may not even be possible, which is a huge setback. Here is a screenshot of our current WinForms designer. As you can see, it is used to create customized user interfaces. You can drag custom controls onto it and design them, then put the panel into a "run mode" in which all of the controls become functional.

Short of spending months writing our designer, would this be possible in WPF? What about .NET 4.0 and VS2010? Will those add any designer functionality?

alt text http://img94.imageshack.us/img94/5378/oldpaneldesigner.png

like image 991
Charlie Avatar asked Mar 02 '10 20:03

Charlie


1 Answers

Unfortunately, there may not be a good answer depending on exactly what you want to do. Your question is a little vague as to exactly what you are trying to do. Are you trying to simply extend the existing designer within Visual Studio, or are you trying to host the WPF designer in your own separate application?

If the latter, you may unfortunately not be able to do that. The WinForms designer was actually part of the .NET Framework (not Visual Studio) and so was accessible to any application that provided the correct hosting environment. There is a good article on MSDN on how to do that here, and another one on from DivElements here.

Many people have asked in other forums whether the same is possible using Cider (the code name for the WPF designer), and it seems like the answer is no. Your only potential alternative is to redesign your application to make use of the Visual Studio Isolated Shell. There is a good overview of the options here.

EDIT: It looks like SharpDevelop may have a WPF designer you can use. I'm not 100% sure if they developed their own, or if they figured out a way to host it, but you can look at their source and decide for yourself. Go to the Daily Builds of Sharp Develop (it's not in the official build yet) and get the latest daily build. In that zip file, look at the Samples/XamlDesigner directory.

like image 144
Nick Avatar answered Oct 14 '22 04:10

Nick