App.xaml and App.xaml.cs is your applicaton's entry point. Main()
is actually auto-generated and hidden in the partial App class. In the XAML, you can set the Window
that will initially display, so you are not forced to use Window1.
In reality, you don't need App.xaml either. In some applications I have made, I have instead opted to create an App.cs, where I manually create the Main()
entry point and start the initial Window. If you don't need such fine control over your Main()
method, I'd recommend keeping the default XAML method of startup. You can still subscribe to events in App's constructor using the XAML method, for startup code and handling unhandled exceptions.
You should put local variables with the class that needs them. Global variables are bad, but it's be better to use static classes and variables instead of inserting the unnecessary code in App.xaml.cs.