Reputation: 6131
I am trying to do some customization to App.xaml.cs
to try to set some behaviors/events. Mostly researching, nothing special.
But whatever I do to the App.xaml.class
there is no effect.
I even emptied the App.xaml.cs
class (nothing in it) and the WPF program still compiles.
I cant even start learning until I solve this mystery.
Upvotes: 1
Views: 4880
Reputation: 1057
If you want to do customization, you can implement a StartUp event, and do your customization there.
You define the event in App.xaml:
<Application x:Class="Test.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="Application_Startup">
And if you remove the StartUpUri, you can also instantiate the main window for yourself.
Upvotes: 1
Reputation: 102763
There's no mystery. It's possible to completely empty App.xaml.cs
, because it is a partial class. The App.xaml
is perfectly capable of standing on its own.
To do customization, take a look at the Application
class on MSDN, in particular the section under "Remarks", which has info about the application life cycle, and application-scope objects (window, resources).
Upvotes: 2