Mohammad Mirmostafa
Mohammad Mirmostafa

Reputation: 1775

In WPF force App to inherit from a class defferent from System.Windows.Application

I want to change App's base class to inherit from my own class in a class library. It is already like this:

public partial class App : System.Windows.Application

Now I want to change it to

public partial class App : MainModule.App

whère MainModule.App is in a class library. When I change it, App.g.i.cs doesn't let me because it inherits from System.Windows.Application . When I change App.g.i.cs after compiling it goes back to its default: System.Windows.Application. Is there any way to force App class to inherit from my class?.

Note that MainModule.App inherits from System.Windows.Application.

Upvotes: 4

Views: 596

Answers (1)

Mohammad Mirmostafa
Mohammad Mirmostafa

Reputation: 1775

I did it. I did 2 works: 1- I changed MainModule.App to MainModule.MyApp. 2- I changed App.xaml to:

<mainModule:MyApp x:Class="FrontOffice.XBAP.App"
...
xmlns:mainModule="clr-namespace:MainModule;assembly=MainModule">

It's now working.

Upvotes: 2

Related Questions