views:

607

answers:

1

I have a WPF Composite application and I want to create a customized messagebox, I wondered what project type I should use to create it?

  1. A usercontrol
  2. A WPF Application
  3. A Class Library

I have to then be able to use this MessageBox in other places in my application.

+2  A: 

I have to then be able to use this MessageBox in other places in my application.

Since you want to share and reuse the component, you should probably not use an application project; it is technically possible to reference an application project from another project, but it's not very idiomatic. So you want a library project instead. In Visual Studio, the Class Library, WPF Custom Control Library and WPF User Control project types are all library projects: the only difference is which system DLL references are set up for you, the initial files generated, and what VS puts on the Add Item menu.

So any of these three options will be fine, but my recommendation would be either WPF User Control Library or WPF Custom Control Library since that will:

  1. automatically include references to the WPF DLLs; and
  2. set up the Add Item menu to make it easier for you to add actual controls to the library in future (since you are bound to come up with some reusable controls as well as your message box, and you may as well stick them in the same project).
itowlson