When coding WinForms applications, I always start with an empty project, then add an Application Class, Forms, etc... In doing so, I can build up the application from scratch, keeping it clean, without all the "fluff" of the Standard WinForms projects, which add Forms, etc... for you.
I want to do the same with WPF. I've created my application class, made a Window class and I can run the application just fine, but there is no XAML associated with the window because I'm just declaring it as a derived class from Window.
My question is, can WPF -Windows be added to a project like WinForms -Forms such that the XAML is also added and the designer can be used to layout the controls etc...? Or do I have to use the canned "WPF Project" and go from there?
Apparently it's not possible to create an Empty Project and add XAML backed Windows. If anyone knows why, I would appreciate an explanation. (You can, however, create programmatically generated windows, or if you want your own startup object in a default WPF Project, simple delete the App.xaml and add your own class with a static Main().)
class OrderEntry : System.Windows.Application
{
[STAThread]
static void Main(string[] commandLine)
{
OrderEntry app = new OrderEntry();
app.MainWindow = new WindowMain();
app.MainWindow.Show();
app.Run();
}
}
public partial class WindowMain : System.Windows.Window
{
}
Works fine, but WindowMain has no XAML associated with it.