views:

309

answers:

1

Hello all,

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

+1  A: 

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.

Nick
Edited my question to add information. We are trying to host the designer in our application, and obviously the Isolated Shell is not a solution for us. I am shocked there is such a lack of support from Microsoft on this topic- it seems they have simply ignored the possibility of this scenario.
Charlie
It doesn't sound like they ignored the scenario... but rather they either A. Ran out of time, or B. Decided that the best way to do it and control the usage was through the Isolated Shell. Do look at the Isolated Shell though... it is HIGHLY customizable.
Nick
Edited to add another possible resource... SharpDevelop may have figured out a way to do this. There is a link to their code in my edited answer.
Nick
After looking at SharpDevelop it appears they have rolled their own designer. I found another designer option called Aurora, which is an integrated XAML designer: http://www.dotnetuidevelopment.com/auroraembedded.htm. Still, I appreciate the information so I'll give you the reward.
Charlie