Preview of code-only WPF controls in VS2010 - how?

Posted by Christian on Stack Overflow See other posts from Stack Overflow or by Christian
Published on 2010-05-01T19:58:13Z Indexed on 2010/05/01 23:37 UTC
Read the original article Hit count: 173

Filed under:
|

Hi,

I hope I am able to illustrate the problem using a lot of images. First of all, I was no real fan of XAML (Silverlight issues, crashes in Preview, and so on...)

Now, with VS2010 the situation has become better. There are still a lot of things I like better in code, but I also want a preview in my VS.

So, take a look at the following control: It is really simple, a todo details list. The first screenshot shows the code of the control, pretty straighforward:

CodebasedControl

There is no XAML, so obviously no preview. Of course, I could encapsulate it in another control, like shown in the next screenshot:

CodebasedControl

But, in that case I have an additional file I do not want or need. So I had the idea to move the init stuff inside the contructor of a XAML control. For simplicity, I used simple elements. But they do not show up in the preview...

CodebasedControl

CodebasedControl

Finally, I know I could use the controls in other parts of my app when creating UIs. But I am using layout manager, PRISM and a lot of other stuff, so I just want an easy preview of some specific control I created (without having to have a XAML wrapper file for each control)

Thanks for help, and sorry for the post structure, but I though with images it is better to understand...

Chris

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf