// BaseObjectWindow.cs
public partial class BaseObjectWindow : Window {
public BaseObjectWindow() {
// I want to call InitializeComponent() here
}
//more constructors
}
// AccountWindow.xaml.cs
public partial class AccountWindow : BaseObjectWindow {
// I want to remove this whole constructor
public AccountWindow() : base() {
InitializeComponent();
}
}
I want to be able to call InitializeComponent()
from the base class so I don't have to call it in the subclasses. The reason I want to do this is because BaseObjectWindow
has multiple constructors and C# refuses to implicitly inherit all constructors if you define at least one.
I'm thinking I can save a lot of time by bypassing declaring all constructor for each and every subclass window I need to make (at least 20) but I can't do that if I can't call InitializeComponent()
from the super class otherwise the subclass windows initialize as an empty window.
Is there any way to work around this cleanly?